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) <BPSTAT_WHAT_CLEAR_LONGJMP_RESUME>:
	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.
This commit is contained in:
Jan Kratochvil
2012-06-18 17:28:38 +00:00
parent 09d5912c6f
commit e2e4d78b22
12 changed files with 367 additions and 21 deletions

View File

@@ -65,6 +65,12 @@ enum bptype
bp_longjmp, /* secret breakpoint to find longjmp() */
bp_longjmp_resume, /* secret breakpoint to escape longjmp() */
/* Breakpoint placed to the same location(s) like bp_longjmp but used to
protect against stale DUMMY_FRAME. Multiple bp_longjmp_call_dummy and
one bp_call_dummy are chained together by related_breakpoint for each
DUMMY_FRAME. */
bp_longjmp_call_dummy,
/* An internal breakpoint that is installed on the unwinder's
debug hook. */
bp_exception,
@@ -94,14 +100,8 @@ enum bptype
3) It can never be disabled. */
bp_watchpoint_scope,
/* The breakpoint at the end of a call dummy. */
/* FIXME: What if the function we are calling longjmp()s out of
the call, or the user gets out with the "return" command? We
currently have no way of cleaning up the breakpoint in these
(obscure) situations. (Probably can solve this by noticing
longjmp, "return", etc., it's similar to noticing when a
watchpoint on a local variable goes out of scope (with hardware
support for watchpoints)). */
/* The breakpoint at the end of a call dummy. See bp_longjmp_call_dummy it
is chained with by related_breakpoint. */
bp_call_dummy,
/* A breakpoint set on std::terminate, that is used to catch
@@ -1287,6 +1287,9 @@ extern void delete_longjmp_breakpoint (int thread);
/* Mark all longjmp breakpoints from THREAD for later deletion. */
extern void delete_longjmp_breakpoint_at_next_stop (int thread);
extern struct breakpoint *set_longjmp_breakpoint_for_call_dummy (void);
extern void check_longjmp_breakpoint_for_call_dummy (int thread);
extern void enable_overlay_breakpoints (void);
extern void disable_overlay_breakpoints (void);