diff options
author | Kevin Buettner <kevinb@redhat.com> | 2001-05-06 22:22:03 +0000 |
---|---|---|
committer | Kevin Buettner <kevinb@redhat.com> | 2001-05-06 22:22:03 +0000 |
commit | 5804effc2da38cf13cabc7a84a2c314dd4bd6d1e (patch) | |
tree | 2cc0af23c1ce60fe47549b576a92385dc9437394 /gdb/breakpoint.c | |
parent | 97692badc52dec581548db39d8a94936032dbc2c (diff) | |
download | gdb-5804effc2da38cf13cabc7a84a2c314dd4bd6d1e.tar.gz |
Consolidate save_inferior_ptid/restore_inferior_ptid implementation to
one source file.
Diffstat (limited to 'gdb/breakpoint.c')
-rw-r--r-- | gdb/breakpoint.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 272fac06a53..6abca265b47 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -1061,10 +1061,10 @@ reattach_breakpoints (int pid) { register struct breakpoint *b; int val; - ptid_t saved_inferior_ptid = inferior_ptid; + struct cleanup *old_chain = save_inferior_ptid (); - /* FIXME: use a cleanup, to insure that inferior_ptid gets replaced! */ - inferior_ptid = pid_to_ptid (pid); /* Because remove_breakpoint will use this global. */ + /* Set inferior_ptid; remove_breakpoint uses this global. */ + inferior_ptid = pid_to_ptid (pid); ALL_BREAKPOINTS (b) { if (b->inserted) @@ -1076,12 +1076,12 @@ reattach_breakpoints (int pid) val = target_insert_breakpoint (b->address, b->shadow_contents); if (val != 0) { - inferior_ptid = saved_inferior_ptid; + do_cleanups (old_chain); return val; } } } - inferior_ptid = saved_inferior_ptid; + do_cleanups (old_chain); return 0; } @@ -1221,13 +1221,13 @@ detach_breakpoints (int pid) { register struct breakpoint *b; int val; - ptid_t saved_inferior_ptid = inferior_ptid; + struct cleanup *old_chain = save_inferior_ptid (); if (pid == PIDGET (inferior_ptid)) error ("Cannot detach breakpoints of inferior_ptid"); - /* FIXME: use a cleanup, to insure that inferior_ptid gets replaced! */ - inferior_ptid = pid_to_ptid (pid); /* Because remove_breakpoint will use this global. */ + /* Set inferior_ptid; remove_breakpoint uses this global. */ + inferior_ptid = pid_to_ptid (pid); ALL_BREAKPOINTS (b) { if (b->inserted) @@ -1235,12 +1235,12 @@ detach_breakpoints (int pid) val = remove_breakpoint (b, mark_inserted); if (val != 0) { - inferior_ptid = saved_inferior_ptid; + do_cleanups (old_chain); return val; } } } - inferior_ptid = saved_inferior_ptid; + do_cleanups (old_chain); return 0; } |