diff options
author | Keith Seitz <keiths@redhat.com> | 2015-09-30 14:23:12 -0700 |
---|---|---|
committer | Keith Seitz <keiths@redhat.com> | 2015-10-01 11:48:39 -0700 |
commit | 23916b7dc0f2f05982da7a76726d931cf738d2cc (patch) | |
tree | b08bad1994250bf0a7d849fe099fd6f5c2d7da80 /gdb/infrun.c | |
parent | 398e081380a204e3b9fb4eb4da069ccf471f930e (diff) | |
download | fsf-binutils-gdb-users/keiths/intelligent-breakpoint_re_set.zip fsf-binutils-gdb-users/keiths/intelligent-breakpoint_re_set.tar.gz fsf-binutils-gdb-users/keiths/intelligent-breakpoint_re_set.tar.bz2 |
Initial publication of breakpoint reset project.users/keiths/intelligent-breakpoint_re_set
This is a work-in-progress publication of an intelligent breakpoint_re_set
redesign. See the project wiki page for more information:
https://sourceware.org/gdb/wiki/BreakpointReset
Diffstat (limited to 'gdb/infrun.c')
-rw-r--r-- | gdb/infrun.c | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/gdb/infrun.c b/gdb/infrun.c index cf91370..0b1f451 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -839,6 +839,7 @@ follow_fork (void) static void follow_inferior_reset_breakpoints (void) { + struct breakpoint_reset_reason reset_reason; struct thread_info *tp = inferior_thread (); /* Was there a step_resume breakpoint? (There was if the user @@ -872,7 +873,10 @@ follow_inferior_reset_breakpoints (void) were never set in the child, but only in the parent. This makes sure the inserted breakpoints match the breakpoint list. */ - breakpoint_re_set (); + init_breakpoint_reset_reason (&reset_reason); + /*reset_reason.reason = BREAKPOINT_RESET_???;*/ + reset_reason.where = __func__; + breakpoint_re_set (&reset_reason); insert_breakpoints (); } @@ -1096,6 +1100,7 @@ follow_exec (ptid_t ptid, char *execd_pathname) struct inferior *inf = current_inferior (); int pid = ptid_get_pid (ptid); ptid_t process_ptid; + struct breakpoint_reset_reason reset_reason; /* This is an exec event that we actually wish to pay attention to. Refresh our symbol table to the newly exec'd program, remove any @@ -1246,11 +1251,29 @@ follow_exec (ptid_t ptid, char *execd_pathname) registers. */ target_find_description (); - solib_create_inferior_hook (0); + /* Errors on solib_create_inferior_hook are swallowed. In all likelihood, + the user has a breakpoint on a user function (like `main') which appears + in both the old exec and the new. solib_create_inferior_hook will + may call solib_add, which may call update_global_location_list, which + may attempt to insert the breakpoints. Since we haven't/can't yet + reset all breakpoints, the user's breakpoint may fail to insert. + That does not mean, however, that we should just bail. Any real errors + resetting/inserting breakpoints will also be triggered when we do reset + all the breakpoints, just below. */ + TRY + { + solib_create_inferior_hook (0); + } + CATCH (ex, RETURN_MASK_ERROR) + { + } + END_CATCH jit_inferior_created_hook (); - breakpoint_re_set (); + init_breakpoint_reset_reason (&reset_reason); + reset_reason.where = __func__; + breakpoint_re_set (&reset_reason); /* Reinsert all breakpoints. (Those which were symbolic have been reset to the proper address in the new a.out, thanks |