how@IRIS.UCDAVIS.EDU (W. Wilson Ho) (01/07/89)
The following bug happens on both Vax and Sun. The version is 3.0.
Gdb gets a segmentation fault whenever it needs to evaluate a
logical AND or OR operation. Here is the script:
-------------
GDB 3.0, Copyright (C) 1988 Free Software Foundation, Inc.
There is ABSOLUTELY NO WARRANTY for GDB; type "info warranty" for details.
GDB is free software and you are welcome to distribute copies of it
under certain conditions; type "info copying" to see the conditions.
Reading symbol data from /usr/src/test/gdb-3.0/gdb2...done.
Type "help" for a list of commands.
(gdb) r
Starting program: /usr/src/test/gdb-3.0/gdb2
GDB 3.0, Copyright (C) 1988 Free Software Foundation, Inc.
There is ABSOLUTELY NO WARRANTY for GDB; type "info warranty" for details.
GDB is free software and you are welcome to distribute copies of it
under certain conditions; type "info copying" to see the conditions.
Type "help" for a list of commands.
(mygdb) print 1||2
Program received signal 11, Segmentation fault
0xe18e in binop_user_defined_p (op=BINOP_OR, arg1=(value) 0x49244, arg2=(value) 0x0) (valarith.c line 113)
(gdb) where
#0 0xe18e in binop_user_defined_p (op=BINOP_OR, arg1=(value) 0x49244, arg2=(value) 0x0) (valarith.c line 113)
#1 0xc13f in evaluate_subexp (expect_type=(struct type *) 0x0, exp=(struct expression *) 0x3c784, pos=(int *) 0x7fffe0bc, noside=EVAL_NORMAL) (eval.c line 509)
#2 0xc13f in evaluate_subexp (expect_type=(struct type *) 0x0, exp=(struct expression *) 0x3c784, pos=(int *) 0x7fffe0bc, noside=EVAL_NORMAL) (eval.c line 509)
#3 0xb6ec in evaluate_expression (exp=(struct expression *) 0x3c784) (eval.c line 121)
#4 0x1095a in print_command (exp=(char *) 0x3c006 "1||2", 1) (printcmd.c line 491)
#5 0xa11 in execute_command (p=(char *) 0x3c006 "1||2", from_tty=1) (main.c line 416)
#6 0xb96 in command_loop () (main.c line 466)
#7 0x8ae in main (argc=1, argv=(char **) 0x7fffe1b4, envp=(char **) 0x7fffe1bc) (main.c line 359)
(gdb) quit
The program is running. Quit anyway? (y or n) y
-------------
Apparently in evaluate_subexp() in eval.c, under the case BINOP_AND
and BINOP_OR, arg2 was not evaluated before being passed to
binop_user_defined_p() .
Thanks,
Wilson Ho
-------------------------------------------------------------------------------
W. Wilson Ho | INTERNET: how@iris.ucdavis.edu
Division of Computer Science | UUCP: {lll-crg, ucbvax}!ucdavis!iris!how
EECS Department |
University of California | Phone: (916)752-7109
Davis, CA 95616 |
-------------------------------------------------------------------------------