diff options
author | Pedro Alves <palves@redhat.com> | 2008-05-04 19:39:00 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2008-05-04 19:39:00 +0000 |
commit | 611c83ae477b587e7d93636cc6c241d063bb799b (patch) | |
tree | 7cdaf24d35c6947b48b50b9cb32172d757115169 /gdb/infcmd.c | |
parent | ff013f42f48f16bd8606a109bcaa49b7aa90499a (diff) | |
download | gdb-611c83ae477b587e7d93636cc6c241d063bb799b.zip gdb-611c83ae477b587e7d93636cc6c241d063bb799b.tar.gz gdb-611c83ae477b587e7d93636cc6c241d063bb799b.tar.bz2 |
gdb/
* breakpoint.c (update_breakpoints_after_exec): Delete bp_longjmp
and bp_longjmp_resume breakpoints.
(breakpoint_address_is_meaningful): Claim bp_longjmp_resume as
meaningful.
(create_longjmp_breakpoint): Don't create bp_longjmp_resume
breakpoints. Create bp_longjmp breakpoints as momentary
breakpoints.
(enable_longjmp_breakpoint): Delete.
(set_longjmp_breakpoint): New.
(disable_longjmp_breakpoint): Delete.
(delete_longjmp_breakpoint): New.
(set_longjmp_resume_breakpoint): Delete.
(set_momentary_breakpoint_at_pc): New.
(breakpoint_re_set_one): Don't delete bp_longjmp and
bp_longjmp_resume breakpoints.
(breakpoint_re_set): Don't create longjmp and longjmp-resume
breakpoints.
* infrun.c (step_resume_breakpoint): Add comment.
(struct execution_control_state): Delete handling_longjmp member.
(init_execution_control_state). Don't clear handling_longjmp.
(context_switch): Don't context switch handling_longjmp.
(handle_inferior_event): If handling a bp_longjmp breakpoint,
create a bp_longjmp_resume breakpoint, and set it as current
step_resume_breakpoint, then step over the longjmp breakpoint. If
handling a bp_longjmp_resume breakpoint, don't delete the longjmp
breakpoint, delete the longjmp-resume breakpoint, and stop
stepping.
(currently_stepping): Remove handling_longjmp from expression.
(insert_step_resume_breakpoint_at_sal): Update comment.
(insert_longjmp_resume_breakpoint): New.
* breakpoint.h (set_momentary_breakpoint_at_pc): Declare.
(enable_longjmp_breakpoint, disable_longjmp_breakpoint): Delete
declarations.
(set_longjmp_breakpoint, delete_longjmp_breakpoint): Declare.
(set_longjmp_resume_breakpoint): Delete declaration.
* gdbthread.h (save_infrun_state): Remove handling_longjmp
parameter.
(load_infrun_state): Delete *handling_longjmp parameter.
* thread.c (save_infrun_state): Remove handling_longjmp parameter.
Update body.
(load_infrun_state): Delete *handling_longjmp parameter. Update
body.
* infcmd.c (disable_longjmp_breakpoint_cleanup): Delete.
(delete_longjmp_breakpoint_cleanup): New.
(step_1): Call set_longjmp_breakpoint instead of
enable_longjmp_breakpoint. Use delete_longjmp_breakpoint_cleanup
instead of disable_longjmp_breakpoint_cleanup when making cleanup.
(step_1_continuation): Pass thread id in the continuation args to
step_once.
(step_once): Add thread parameter. Pass thread id the the
continuation.
gdb/testsuite/
* gdb.cp/annota2.exp: Adjust to breakpoints invalidations at
different times.
Diffstat (limited to 'gdb/infcmd.c')
-rw-r--r-- | gdb/infcmd.c | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 3165a26..b75c524 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -107,7 +107,7 @@ static void signal_command (char *, int); static void jump_command (char *, int); static void step_1 (int, int, char *); -static void step_once (int skip_subroutines, int single_inst, int count); +static void step_once (int skip_subroutines, int single_inst, int count, int thread); static void step_1_continuation (struct continuation_arg *arg, int error_p); static void next_command (char *, int); @@ -693,9 +693,10 @@ nexti_command (char *count_string, int from_tty) } static void -disable_longjmp_breakpoint_cleanup (void *ignore) +delete_longjmp_breakpoint_cleanup (void *arg) { - disable_longjmp_breakpoint (); + int thread = * (int *) arg; + delete_longjmp_breakpoint (thread); } static void @@ -705,6 +706,7 @@ step_1 (int skip_subroutines, int single_inst, char *count_string) struct frame_info *frame; struct cleanup *cleanups = make_cleanup (null_cleanup, NULL); int async_exec = 0; + int *thread_p = NULL; ERROR_NO_INFERIOR; @@ -728,8 +730,17 @@ step_1 (int skip_subroutines, int single_inst, char *count_string) if (!single_inst || skip_subroutines) /* leave si command alone */ { - enable_longjmp_breakpoint (); - make_cleanup (disable_longjmp_breakpoint_cleanup, 0 /*ignore*/); + thread_p = xmalloc (sizeof (int)); + make_cleanup (xfree, thread_p); + + if (in_thread_list (inferior_ptid)) + *thread_p = pid_to_thread_id (inferior_ptid); + else + *thread_p = -1; + + set_longjmp_breakpoint (); + + make_cleanup (delete_longjmp_breakpoint_cleanup, thread_p); } /* In synchronous case, all is well, just use the regular for loop. */ @@ -790,10 +801,11 @@ which has no line number information.\n"), name); and handle them one at the time, through step_once(). */ else { - step_once (skip_subroutines, single_inst, count); - /* We are running, and the contination is installed. It will + step_once (skip_subroutines, single_inst, count, *thread_p); + /* We are running, and the continuation is installed. It will disable the longjmp breakpoint as appropriate. */ discard_cleanups (cleanups); + xfree (thread_p); } } @@ -808,10 +820,12 @@ step_1_continuation (struct continuation_arg *arg, int error_p) int count; int skip_subroutines; int single_inst; + int thread; skip_subroutines = arg->data.integer; single_inst = arg->next->data.integer; count = arg->next->next->data.integer; + thread = arg->next->next->next->data.integer; if (error_p || !step_multi || !stop_step) { @@ -819,11 +833,11 @@ step_1_continuation (struct continuation_arg *arg, int error_p) that is not stepping, or there are no further steps to make. Cleanup. */ if (!single_inst || skip_subroutines) - disable_longjmp_breakpoint (); + delete_longjmp_breakpoint (thread); step_multi = 0; } else - step_once (skip_subroutines, single_inst, count - 1); + step_once (skip_subroutines, single_inst, count - 1, thread); } /* Do just one step operation. If count >1 we will have to set up a @@ -834,11 +848,12 @@ step_1_continuation (struct continuation_arg *arg, int error_p) called in case of step n with n>1, after the first step operation has been completed.*/ static void -step_once (int skip_subroutines, int single_inst, int count) +step_once (int skip_subroutines, int single_inst, int count, int thread) { struct continuation_arg *arg1; struct continuation_arg *arg2; struct continuation_arg *arg3; + struct continuation_arg *arg4; struct frame_info *frame; if (count > 0) @@ -894,12 +909,16 @@ which has no line number information.\n"), name); (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg)); arg3 = (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg)); + arg4 = + (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg)); arg1->next = arg2; arg1->data.integer = skip_subroutines; arg2->next = arg3; arg2->data.integer = single_inst; - arg3->next = NULL; + arg3->next = arg4; arg3->data.integer = count; + arg4->next = NULL; + arg4->data.integer = thread; add_intermediate_continuation (step_1_continuation, arg1); } } |