aboutsummaryrefslogtreecommitdiff
path: root/gdb/breakpoint.c
diff options
context:
space:
mode:
authorKevin Buettner <kevinb@redhat.com>2001-05-06 22:22:03 +0000
committerKevin Buettner <kevinb@redhat.com>2001-05-06 22:22:03 +0000
commitce696e0556e9ddc48e7d049356a3c3fe6b7399d8 (patch)
tree64ca31984622469dfdf2ff37a3a142eae50f08e8 /gdb/breakpoint.c
parenta7c92daeedfd9d5326113d1776c6db7ed18efcc6 (diff)
downloadgdb-ce696e0556e9ddc48e7d049356a3c3fe6b7399d8.zip
gdb-ce696e0556e9ddc48e7d049356a3c3fe6b7399d8.tar.gz
gdb-ce696e0556e9ddc48e7d049356a3c3fe6b7399d8.tar.bz2
Consolidate save_inferior_ptid/restore_inferior_ptid implementation to
one source file.
Diffstat (limited to 'gdb/breakpoint.c')
-rw-r--r--gdb/breakpoint.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 272fac0..6abca26 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;
}