aboutsummaryrefslogtreecommitdiff
path: root/gdb/infrun.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2018-07-11 13:29:59 -0600
committerTom Tromey <tom@tromey.com>2018-09-17 00:42:19 -0600
commitcb5248409d7a5a10748c2aa70824ecddf2f913d5 (patch)
tree1882af1d9ee8efcb9b96d2701db0b1c4ee12215c /gdb/infrun.c
parent2d844eaf9c60832756cff80af67e16969c0e11fc (diff)
downloadgdb-cb5248409d7a5a10748c2aa70824ecddf2f913d5.zip
gdb-cb5248409d7a5a10748c2aa70824ecddf2f913d5.tar.gz
gdb-cb5248409d7a5a10748c2aa70824ecddf2f913d5.tar.bz2
Make save_infcall_*_state return unique pointers
Simon pointed out that save_infcall_suspend_state and save_infcall_control_state could return unique pointers. This patch implements this idea. gdb/ChangeLog 2018-09-17 Tom Tromey <tom@tromey.com> * infrun.c (save_infcall_suspend_state): Return infcall_suspend_state_up. (save_infcall_control_state): Return infcall_control_state_up. * inferior.h (save_infcall_suspend_state) (save_infcall_control_state): Declare later. Return unique pointers.
Diffstat (limited to 'gdb/infrun.c')
-rw-r--r--gdb/infrun.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 3c3bb96..f1cd85c 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -8813,10 +8813,9 @@ struct infcall_suspend_state
gdb::unique_xmalloc_ptr<gdb_byte> siginfo_data;
};
-struct infcall_suspend_state *
-save_infcall_suspend_state (void)
+infcall_suspend_state_up
+save_infcall_suspend_state ()
{
- struct infcall_suspend_state *inf_state;
struct thread_info *tp = inferior_thread ();
struct regcache *regcache = get_current_regcache ();
struct gdbarch *gdbarch = regcache->arch ();
@@ -8837,7 +8836,7 @@ save_infcall_suspend_state (void)
}
}
- inf_state = new struct infcall_suspend_state;
+ infcall_suspend_state_up inf_state (new struct infcall_suspend_state);
if (siginfo_data)
{
@@ -8917,10 +8916,10 @@ struct infcall_control_state
/* Save all of the information associated with the inferior<==>gdb
connection. */
-struct infcall_control_state *
-save_infcall_control_state (void)
+infcall_control_state_up
+save_infcall_control_state ()
{
- struct infcall_control_state *inf_status = new struct infcall_control_state;
+ infcall_control_state_up inf_status (new struct infcall_control_state);
struct thread_info *tp = inferior_thread ();
struct inferior *inf = current_inferior ();