From e2e4d78b2216962789c8a982d3e889ba6933321a Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Mon, 18 Jun 2012 17:28:38 +0000 Subject: gdb/ Remove stale dummy frames. * breakpoint.c: Include dummy-frame.h. (longjmp_breakpoint_ops): New variable. (update_breakpoints_after_exec, breakpoint_init_inferior): Delete also bp_longjmp_call_dummy. (bpstat_what, bptype_string, print_one_breakpoint_location) (init_bp_location): Support bp_longjmp_call_dummy. (set_longjmp_breakpoint): Use longjmp_breakpoint_ops. Comment why. (set_longjmp_breakpoint_for_call_dummy) (check_longjmp_breakpoint_for_call_dummy, longjmp_bkpt_dtor): New functions. (initialize_breakpoint_ops): Initialize longjmp_breakpoint_ops. * breakpoint.h (enum bptype): New item bp_longjmp_call_dummy. Delete FIXME comment and extend the other comment for bp_call_dummy. (set_longjmp_breakpoint_for_call_dummy) (check_longjmp_breakpoint_for_call_dummy): New declarations. * dummy-frame.c: Include gdbthread.h. (pop_dummy_frame_bpt): New function. (pop_dummy_frame): Call pop_dummy_frame_bpt. (dummy_frame_discard): New function. (cleanup_dummy_frames): Update the comment about longjmps. * dummy-frame.h (dummy_frame_discard): New declaration. * gdbthread.h (struct thread_info): Extend initiating_frame comment. * infcall.c (call_function_by_hand): New variable longjmp_b. Call set_longjmp_breakpoint_for_call_dummy. Chain its breakpoints with BPT. * infrun.c (handle_inferior_event) : Add case 4 comment. Call check_longjmp_breakpoint_for_call_dummy and keep_going if IS_LONGJMP and there is no other reason to stop. gdb/testsuite/ Remove stale dummy frames. * gdb.base/call-signal-resume.exp (maintenance print dummy-frames) (maintenance info breakpoints): New tests. * gdb.base/stale-infcall.c: New file. * gdb.base/stale-infcall.exp: New file. --- gdb/infcall.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'gdb/infcall.c') diff --git a/gdb/infcall.c b/gdb/infcall.c index 20a2c2baad4..51cd11829d9 100644 --- a/gdb/infcall.c +++ b/gdb/infcall.c @@ -744,7 +744,7 @@ call_function_by_hand (struct value *function, int nargs, struct value **args) inferior. That way it breaks when it returns. */ { - struct breakpoint *bpt; + struct breakpoint *bpt, *longjmp_b; struct symtab_and_line sal; init_sal (&sal); /* initialize to zeroes */ @@ -760,6 +760,17 @@ call_function_by_hand (struct value *function, int nargs, struct value **args) frame = NULL; bpt->disposition = disp_del; + gdb_assert (bpt->related_breakpoint == bpt); + + longjmp_b = set_longjmp_breakpoint_for_call_dummy (); + if (longjmp_b) + { + /* Link BPT into the chain of LONGJMP_B. */ + bpt->related_breakpoint = longjmp_b; + while (longjmp_b->related_breakpoint != bpt->related_breakpoint) + longjmp_b = longjmp_b->related_breakpoint; + longjmp_b->related_breakpoint = bpt; + } } /* Create a breakpoint in std::terminate. -- cgit v1.2.1