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/infrun.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/infrun.c')
-rw-r--r-- | gdb/infrun.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/gdb/infrun.c b/gdb/infrun.c index a62a72c069c..21d07f27759 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -4192,6 +4192,30 @@ discard_inferior_status (struct inferior_status *inf_status) free_inferior_status (inf_status); } +/* Helper function for save_inferior_ptid */ + +static void +restore_inferior_ptid (void *arg) +{ + ptid_t *saved_ptid_ptr = arg; + inferior_ptid = *saved_ptid_ptr; + xfree (arg); +} + +/* Save the value of inferior_ptid so that it may be restored by a + later call to do_cleanups(). Returns the struct cleanup pointer + needed for later doing the cleanup. */ + +struct cleanup * +save_inferior_ptid (void) +{ + ptid_t *saved_ptid_ptr; + + saved_ptid_ptr = xmalloc (sizeof (ptid_t)); + *saved_ptid_ptr = inferior_ptid; + return make_cleanup (restore_inferior_ptid, saved_ptid_ptr); +} + static void build_infrun (void) |