aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2019-01-23 18:58:34 +0000
committerPedro Alves <palves@redhat.com>2019-01-23 19:06:41 +0000
commit1db93f14fae0b3a638324e5349fe56a0e625451e (patch)
treef772610b174a828a2400ebfafb330a7adec930af /gdb
parent2cc83d1e0eeaad9927553ee157f810e43d47d24f (diff)
downloadgdb-1db93f14fae0b3a638324e5349fe56a0e625451e.zip
gdb-1db93f14fae0b3a638324e5349fe56a0e625451e.tar.gz
gdb-1db93f14fae0b3a638324e5349fe56a0e625451e.tar.bz2
Remove cleanup from linux-nat.c
This removes a cleanup from linux-nat.c, replacing it with a scope_exit. gdb/ChangeLog: 2019-01-23 Tom Tromey <tom@tromey.com> Pedro Alves <palves@redhat.com> * linux-nat.c: Include scope-exit.h. (cleanup_target_stop): Remove. (linux_nat_target::static_tracepoint_markers_by_strid): Use SCOPE_EXIT.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog8
-rw-r--r--gdb/linux-nat.c18
2 files changed, 11 insertions, 15 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 21b72e3..4ee6051 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,6 +1,14 @@
2019-01-23 Tom Tromey <tom@tromey.com>
Pedro Alves <palves@redhat.com>
+ * linux-nat.c: Include scope-exit.h.
+ (cleanup_target_stop): Remove.
+ (linux_nat_target::static_tracepoint_markers_by_strid): Use
+ SCOPE_EXIT.
+
+2019-01-23 Tom Tromey <tom@tromey.com>
+ Pedro Alves <palves@redhat.com>
+
* infcall.c (cleanup_delete_std_terminate_breakpoint): Remove.
(call_function_by_hand_dummy): Use SCOPE_EXIT.
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index c0d5f8d..45da9fa 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -66,6 +66,7 @@
#include "objfiles.h"
#include "nat/linux-namespaces.h"
#include "fileio.h"
+#include "common/scope-exit.h"
#ifndef SPUFS_MAGIC
#define SPUFS_MAGIC 0x23c9b64e
@@ -4223,22 +4224,10 @@ linux_nat_xfer_osdata (enum target_object object,
return TARGET_XFER_OK;
}
-static void
-cleanup_target_stop (void *arg)
-{
- ptid_t *ptid = (ptid_t *) arg;
-
- gdb_assert (arg != NULL);
-
- /* Unpause all */
- target_continue_no_signal (*ptid);
-}
-
std::vector<static_tracepoint_marker>
linux_nat_target::static_tracepoint_markers_by_strid (const char *strid)
{
char s[IPA_CMD_BUF_SIZE];
- struct cleanup *old_chain;
int pid = inferior_ptid.pid ();
std::vector<static_tracepoint_marker> markers;
const char *p = s;
@@ -4253,7 +4242,8 @@ linux_nat_target::static_tracepoint_markers_by_strid (const char *strid)
agent_run_command (pid, s, strlen (s) + 1);
- old_chain = make_cleanup (cleanup_target_stop, &ptid);
+ /* Unpause all. */
+ SCOPE_EXIT { target_continue_no_signal (ptid); };
while (*p++ == 'm')
{
@@ -4272,8 +4262,6 @@ linux_nat_target::static_tracepoint_markers_by_strid (const char *strid)
p = s;
}
- do_cleanups (old_chain);
-
return markers;
}