aboutsummaryrefslogtreecommitdiff
path: root/gdb/linux-nat.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-11-22 09:30:21 -0700
committerTom Tromey <tom@tromey.com>2017-11-26 10:42:15 -0700
commit41272101db08e20f044dbf0f09b6d79a0fa6c1ac (patch)
tree0e310fc1f5c505889ac90b7c1955295286822640 /gdb/linux-nat.c
parent44287fd89091a833451e74c79e46404c23fdaf9b (diff)
downloadgdb-41272101db08e20f044dbf0f09b6d79a0fa6c1ac.zip
gdb-41272101db08e20f044dbf0f09b6d79a0fa6c1ac.tar.gz
gdb-41272101db08e20f044dbf0f09b6d79a0fa6c1ac.tar.bz2
Change maybe_disable_address_space_randomization to a class
This changes maybe_disable_address_space_randomization to be an RAII class, rather than having it return a cleanup. Regression tested by the buildbot. ChangeLog 2017-11-26 Tom Tromey <tom@tromey.com> * nat/linux-personality.h (class maybe_disable_address_space_randomization): New class. (maybe_disable_address_space_randomization): Don't declare function. * nat/linux-personality.c (restore_personality) (make_disable_asr_cleanup): Remove. (maybe_disable_address_space_randomization): Now a constructor. (~maybe_disable_address_space_randomization): New destructor. * linux-nat.c (linux_nat_create_inferior): Update. gdbserver/ChangeLog 2017-11-26 Tom Tromey <tom@tromey.com> * linux-low.c (linux_create_inferior): Update.
Diffstat (limited to 'gdb/linux-nat.c')
-rw-r--r--gdb/linux-nat.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index a6395f4..96cb21a 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -1118,8 +1118,8 @@ linux_nat_create_inferior (struct target_ops *ops,
const char *exec_file, const std::string &allargs,
char **env, int from_tty)
{
- struct cleanup *restore_personality
- = maybe_disable_address_space_randomization (disable_randomization);
+ maybe_disable_address_space_randomization restore_personality
+ (disable_randomization);
/* The fork_child mechanism is synchronous and calls target_wait, so
we have to mask the async mode. */
@@ -1128,8 +1128,6 @@ linux_nat_create_inferior (struct target_ops *ops,
linux_nat_pass_signals (ops, 0, NULL);
linux_ops->to_create_inferior (ops, exec_file, allargs, env, from_tty);
-
- do_cleanups (restore_personality);
}
/* Callback for linux_proc_attach_tgid_threads. Attach to PTID if not