breakpoints/2192: crash when conditional watchpoint on local variable is active and we leave scope

ppluzhnikov@charter.net ppluzhnikov@charter.net
Thu Oct 26 04:58:00 GMT 2006


>Number:         2192
>Category:       breakpoints
>Synopsis:       crash when conditional watchpoint on local variable is active and we leave scope
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Oct 26 04:58:01 UTC 2006
>Closed-Date:
>Last-Modified:
>Originator:     Paul Pluzhnikov
>Release:        All 6.x versions are affected, regression from 5.x
>Organization:
>Environment:
i686-pc-linux-gnu (Fedora Core 4, RedHat-6.2)
>Description:
All gdb-6.x versions crash, when conditional watchpoint
on a local variable is still active and we leave scope of that local.

None of gdb-5.x do ...

The problem reproduces when test case is compiled with
gcc-3.3, 3.4.6, 4.1.1, but not when it is compiled with
gcc (GCC) 4.0.0 20050519 (Red Hat 4.0.0-8)
>How-To-Repeat:
$ cat junk.c && /usr/local/gcc-3.3/bin/gcc -g junk.c && gdb/gdb -q ./a.out
int main()
{
    int x = 1;
    x = 2;
    return 0;
}
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) b main
Breakpoint 1 at 0x8048364: file junk.c, line 3.
(gdb) r

Breakpoint 1, main () at junk.c:3
3           int x = 1j;
(gdb) watch x if x == 3
Hardware watchpoint 2: x
(gdb) c

Watchpoint 2 deleted because the program has left the block in
which its expression is valid.
Segmentation fault
$ 

The stack trace for crash is:
$ gdb/gdb -q gdb/gdb
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) r -q ./a.out
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) b main
Breakpoint 1 at 0x8048364: file junk.c, line 3.
(gdb) r 

Breakpoint 1, main () at junk.c:3
3           int x = 1j;
(gdb) watch x if x == 3
Hardware watchpoint 2: x
(gdb) c

Watchpoint 2 deleted because the program has left the block in
which its expression is valid.

Program received signal SIGSEGV, Segmentation fault.
0x081448eb in dwarf_expr_frame_base (baton=0xbfffe754, start=0xbfffe6f0, 
    length=0xbfffe6ec)
    at /home/camel1/paul/Archive/gdb-weekly-CVS-6.5.50.20061024/src/gdb/dwarf2loc.c:164
164       if (SYMBOL_OPS (framefunc) == &dwarf2_loclist_funcs)
(gdb) p framefunc
$1 = (struct symbol *) 0x0
(gdb) bt
#0  0x081448eb in dwarf_expr_frame_base (baton=0xbfffe754, start=0xbfffe6f0, 
    length=0xbfffe6ec)
    at /home/camel1/paul/Archive/gdb-weekly-CVS-6.5.50.20061024/src/gdb/dwarf2loc.c:164
#1  0x08194cc2 in execute_stack_op (ctx=0x82fdf20, op_ptr=<value optimized out>, 
    op_end=0x8317ac7 "")
    at /home/camel1/paul/Archive/gdb-weekly-CVS-6.5.50.20061024/src/gdb/dwarf2expr.c:466
#2  0x081449da in dwarf2_evaluate_loc_desc (var=0x8317df0, frame=0x82e25ec, 
    data=0x8317ac5 "\221|", size=2, objfile=0x0)
    at /home/camel1/paul/Archive/gdb-weekly-CVS-6.5.50.20061024/src/gdb/dwarf2loc.c:226
#3  0x080df8bf in value_of_variable (var=0x8317df0, b=0x0)
    at /home/camel1/paul/Archive/gdb-weekly-CVS-6.5.50.20061024/src/gdb/valops.c:820
#4  0x080dc5d0 in evaluate_subexp_standard (expect_type=0x0, exp=0x831fb38, 
    pos=0xbfffed94, noside=EVAL_NORMAL)
    at /home/camel1/paul/Archive/gdb-weekly-CVS-6.5.50.20061024/src/gdb/eval.c:468
#5  0x080dac3f in evaluate_subexp (expect_type=0x0, exp=0x0, pos=0x1e9, 
    noside=EVAL_NORMAL)
    at /home/camel1/paul/Archive/gdb-weekly-CVS-6.5.50.20061024/src/gdb/eval.c:72
#6  0x080db741 in evaluate_subexp_standard (expect_type=0x0, exp=0x831fb38, 
    pos=0xbfffed94, noside=EVAL_NORMAL)
    at /home/camel1/paul/Archive/gdb-weekly-CVS-6.5.50.20061024/src/gdb/eval.c:1784
#7  0x080dac3f in evaluate_subexp (expect_type=0x0, exp=0x0, pos=0x1e9, 
    noside=EVAL_NORMAL)
    at /home/camel1/paul/Archive/gdb-weekly-CVS-6.5.50.20061024/src/gdb/eval.c:72
#8  0x080dac60 in evaluate_expression (exp=0x0)
    at /home/camel1/paul/Archive/gdb-weekly-CVS-6.5.50.20061024/src/gdb/eval.c:162
#9  0x080c96d7 in breakpoint_cond_eval (exp=0x831fb38)
    at /home/camel1/paul/Archive/gdb-weekly-CVS-6.5.50.20061024/src/gdb/breakpoint.c:2440
#10 0x08107a32 in catch_errors (func=0x80c96c0 <breakpoint_cond_eval>, 
    func_args=0x831fb38, errstring=0x8226800 "Error in testing breakpoint condition:\n", 
    mask=6)
    at /home/camel1/paul/Archive/gdb-weekly-CVS-6.5.50.20061024/src/gdb/exceptions.c:515
#11 0x080c9a89 in bpstat_stop_status (bp_addr=10394536, ptid=
      {pid = 7234, lwp = 7234, tid = 0}, stopped_by_watchpoint=1)
    at /home/camel1/paul/Archive/gdb-weekly-CVS-6.5.50.20061024/src/gdb/breakpoint.c:2853
#12 0x080ff295 in handle_inferior_event (ecs=0xbffff0cc)
    at /home/camel1/paul/Archive/gdb-weekly-CVS-6.5.50.20061024/src/gdb/infrun.c:1891
#13 0x08100363 in wait_for_inferior ()
    at /home/camel1/paul/Archive/gdb-weekly-CVS-6.5.50.20061024/src/gdb/infrun.c:1009
#14 0x081004de in proceed (addr=4294967295, siggnal=TARGET_SIGNAL_DEFAULT, step=0)
    at /home/camel1/paul/Archive/gdb-weekly-CVS-6.5.50.20061024/src/gdb/infrun.c:827
#15 0x080fa06c in continue_command (proc_count_exp=0x0, from_tty=0)
    at /home/camel1/paul/Archive/gdb-weekly-CVS-6.5.50.20061024/src/gdb/infcmd.c:642
#16 0x0808227d in execute_command (p=0x82ba129 "", from_tty=0)
    at /home/camel1/paul/Archive/gdb-weekly-CVS-6.5.50.20061024/src/gdb/top.c:455
#17 0x0810af01 in command_handler (command=0x82ba128 "c")
    at /home/camel1/paul/Archive/gdb-weekly-CVS-6.5.50.20061024/src/gdb/event-top.c:516
#18 0x0810b3a3 in command_line_handler (rl=0x831be28 "(É1\b\210à/\b")
    at /home/camel1/paul/Archive/gdb-weekly-CVS-6.5.50.20061024/src/gdb/event-top.c:807
#19 0x081a5948 in rl_callback_read_char ()
    at /home/camel1/paul/Archive/gdb-weekly-CVS-6.5.50.20061024/src/readline/callback.c:205
#20 0x0810a847 in rl_callback_read_char_wrapper (client_data=0x0)
    at /home/camel1/paul/Archive/gdb-weekly-CVS-6.5.50.20061024/src/gdb/event-top.c:179
#21 0x0810a0e8 in handle_file_event (event_file_desc=0)
    at /home/camel1/paul/Archive/gdb-weekly-CVS-6.5.50.20061024/src/gdb/event-loop.c:730
#22 0x08109bde in process_event ()
    at /home/camel1/paul/Archive/gdb-weekly-CVS-6.5.50.20061024/src/gdb/event-loop.c:343
#23 0x0810a42b in gdb_do_one_event (data=0x0)
    at /home/camel1/paul/Archive/gdb-weekly-CVS-6.5.50.20061024/src/gdb/event-loop.c:380
#24 0x08107a32 in catch_errors (func=0x810a2ac <gdb_do_one_event>, func_args=0x0, 
    errstring=0x8214e08 "", mask=6)
    at /home/camel1/paul/Archive/gdb-weekly-CVS-6.5.50.20061024/src/gdb/exceptions.c:515
#25 0x080bb637 in tui_command_loop (data=0x0)
    at /home/camel1/paul/Archive/gdb-weekly-CVS-6.5.50.20061024/src/gdb/tui/tui-interp.c:151
#26 0x08107c9c in current_interp_command_loop ()
    at /home/camel1/paul/Archive/gdb-weekly-CVS-6.5.50.20061024/src/gdb/interps.c:278
#27 0x0807d99f in captured_command_loop (data=0x0)
    at /home/camel1/paul/Archive/gdb-weekly-CVS-6.5.50.20061024/src/gdb/main.c:101
#28 0x08107a32 in catch_errors (func=0x807d994 <captured_command_loop>, func_args=0x0, 
    errstring=0x8214e08 "", mask=6)
    at /home/camel1/paul/Archive/gdb-weekly-CVS-6.5.50.20061024/src/gdb/exceptions.c:515
#29 0x0807e03f in captured_main (data=0x0)
    at /home/camel1/paul/Archive/gdb-weekly-CVS-6.5.50.20061024/src/gdb/main.c:826
#30 0x08107a32 in catch_errors (func=0x807d9f8 <captured_main>, func_args=0xbffff5d4, 
    errstring=0x8214e08 "", mask=6)
    at /home/camel1/paul/Archive/gdb-weekly-CVS-6.5.50.20061024/src/gdb/exceptions.c:515
#31 0x0807d9ef in gdb_main (args=0x0)
    at /home/camel1/paul/Archive/gdb-weekly-CVS-6.5.50.20061024/src/gdb/main.c:835
#32 0x0807d98d in main (argc=0, argv=0x0)
    at /home/camel1/paul/Archive/gdb-weekly-CVS-6.5.50.20061024/src/gdb/gdb.c:35
(gdb) 
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gdb-prs mailing list