aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2022-02-22 11:22:14 -0800
committerJohn Baldwin <jhb@FreeBSD.org>2022-02-22 11:22:14 -0800
commite05523bd2411bac0277da73556f4d01f6c7448aa (patch)
tree6bb11c7419e5c176e0ceec0c246ee850f6365cfc
parentd0bbe64c5a3f9608ae5987f1267de7a734ee8151 (diff)
downloadfsf-binutils-gdb-e05523bd2411bac0277da73556f4d01f6c7448aa.zip
fsf-binutils-gdb-e05523bd2411bac0277da73556f4d01f6c7448aa.tar.gz
fsf-binutils-gdb-e05523bd2411bac0277da73556f4d01f6c7448aa.tar.bz2
Enable async mode in the target in attach_cmd.
If the attach target supports async mode, enable it after the attach target's ::attach method returns.
-rw-r--r--gdb/fbsd-nat.c13
-rw-r--r--gdb/fbsd-nat.h2
-rw-r--r--gdb/infcmd.c4
-rw-r--r--gdb/linux-nat.c3
-rw-r--r--gdb/remote.c4
5 files changed, 4 insertions, 22 deletions
diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c
index cea3ce7..6f1f208 100644
--- a/gdb/fbsd-nat.c
+++ b/gdb/fbsd-nat.c
@@ -1025,19 +1025,6 @@ fbsd_nat_target::close ()
inf_ptrace_target::close ();
}
-/* Implement the "attach" target method. */
-
-void
-fbsd_nat_target::attach (const char *args, int from_tty)
-{
- inf_ptrace_target::attach (args, from_tty);
-
- /* Curiously, the core does not do this automatically. */
- if (target_can_async_p ())
- target_async (1);
-}
-
-
#ifdef TDP_RFPPWAIT
/*
To catch fork events, PT_FOLLOW_FORK is set on every traced process
diff --git a/gdb/fbsd-nat.h b/gdb/fbsd-nat.h
index 411573b..0acfef2 100644
--- a/gdb/fbsd-nat.h
+++ b/gdb/fbsd-nat.h
@@ -77,8 +77,6 @@ public:
thread_control_capabilities get_thread_control_capabilities () override
{ return tc_schedlock; }
- void attach (const char *, int) override;
-
void create_inferior (const char *, const std::string &,
char **, int) override;
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 465c8f3..682bebe 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -2600,6 +2600,10 @@ attach_command (const char *args, int from_tty)
thread_state_string (thread->state));
}
+ /* Enable async mode if it is supported by the target. */
+ if (target_can_async_p ())
+ target_async (1);
+
/* Set up the "saved terminal modes" of the inferior
based on what modes we are starting it with. */
target_terminal::init ();
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 58660f0..055da9a 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -1159,9 +1159,6 @@ linux_nat_target::attach (const char *args, int from_tty)
threads and associate pthread info with each LWP. */
linux_proc_attach_tgid_threads (lp->ptid.pid (),
attach_proc_task_lwp_callback);
-
- if (target_can_async_p ())
- target_async (1);
}
/* Ptrace-detach the thread with pid PID. */
diff --git a/gdb/remote.c b/gdb/remote.c
index f285beb..aa6a67a 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -6183,16 +6183,12 @@ extended_remote_target::attach (const char *args, int from_tty)
= remote_notif_parse (this, &notif_client_stop, wait_status);
push_stop_reply ((struct stop_reply *) reply);
-
- if (target_can_async_p ())
- target_async (1);
}
else
{
gdb_assert (wait_status == NULL);
gdb_assert (target_can_async_p ());
- target_async (1);
}
}