summaryrefslogtreecommitdiff
path: root/gdb/gdbserver
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/gdbserver
parent44287fd89091a833451e74c79e46404c23fdaf9b (diff)
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/gdbserver')
-rw-r--r--gdb/gdbserver/ChangeLog4
-rw-r--r--gdb/gdbserver/linux-low.c19
2 files changed, 14 insertions, 9 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index cc3d6bf0cf..6ed0fc2ec6 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,7 @@
+2017-11-26 Tom Tromey <tom@tromey.com>
+
+ * linux-low.c (linux_create_inferior): Update.
+
2017-11-24 Ulrich Weigand <uweigand@de.ibm.com>
* spu-low.c (spu_create_inferior): Fix typo in argument name.
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index 274263a947..c2420fdf57 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -998,16 +998,17 @@ linux_create_inferior (const char *program,
struct lwp_info *new_lwp;
int pid;
ptid_t ptid;
- struct cleanup *restore_personality
- = maybe_disable_address_space_randomization (disable_randomization);
- std::string str_program_args = stringify_argv (program_args);
- pid = fork_inferior (program,
- str_program_args.c_str (),
- get_environ ()->envp (), linux_ptrace_fun,
- NULL, NULL, NULL, NULL);
-
- do_cleanups (restore_personality);
+ {
+ maybe_disable_address_space_randomization restore_personality
+ (disable_randomization);
+ std::string str_program_args = stringify_argv (program_args);
+
+ pid = fork_inferior (program,
+ str_program_args.c_str (),
+ get_environ ()->envp (), linux_ptrace_fun,
+ NULL, NULL, NULL, NULL);
+ }
linux_add_process (pid, 0);