summaryrefslogtreecommitdiff
path: root/gdb/gdbserver/linux-low.c
diff options
context:
space:
mode:
authorDaniel Jacobowitz <dan@debian.org>2003-06-17 20:28:14 +0000
committerDaniel Jacobowitz <dan@debian.org>2003-06-17 20:28:14 +0000
commit27ab33357a061db794254afee4cfabbac5d5668a (patch)
treeee8b6a8050c1f5fa8a9ab8a127ff031071995797 /gdb/gdbserver/linux-low.c
parentd00917dd91c888c954c92e5c0ad6550b6795f485 (diff)
downloadgdb-27ab33357a061db794254afee4cfabbac5d5668a.tar.gz
gdb/
* NEWS: Mention gdbserver detach change and "disconnect" command. * infcmd.c (disconnect_command): New function. (_initialize_infcmd): Add ``disconnect'' command. * remote.c (remote_async_detach): Delete. (remote_detach): Merge remote_async_detach. (remote_disconnect): New. (init_remote_ops): Set to_disconnect. (init_remote_cisco_ops): Likewise. (init_remote_async_ops): Likewise. Use remote_detach. * target.c (cleanup_target): Default to_disconnect. (update_current_target): Inherit to_disconnect. (target_disconnect, debug_to_disconnect): New functions. (setup_target_debug): Set to_disconnect. * target.h (struct target_ops): Add to_disconnect. (target_disconnect): Add prototype. gdbserver/ * linux-low.c: Move comment to linux_thread_alive where it belonged. (linux_detach_one_process, linux_detach): New functions. (linux_target_ops): Add linux_detach. * server.c (main): Handle 'D' packet. * target.h (struct target_ops): Add "detach" member. (detach_inferior): Define. mi/ * mi-cmds.c (mi_cmds): Add "-target-disconnect".
Diffstat (limited to 'gdb/gdbserver/linux-low.c')
-rw-r--r--gdb/gdbserver/linux-low.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index 4ad204ed3ac..c700d40ba3a 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -234,13 +234,28 @@ linux_kill_one_process (struct inferior_list_entry *entry)
} while (WIFSTOPPED (wstat));
}
-/* Return nonzero if the given thread is still alive. */
static void
linux_kill (void)
{
for_each_inferior (&all_threads, linux_kill_one_process);
}
+static void
+linux_detach_one_process (struct inferior_list_entry *entry)
+{
+ struct thread_info *thread = (struct thread_info *) entry;
+ struct process_info *process = get_thread_process (thread);
+
+ ptrace (PTRACE_DETACH, pid_of (process), 0, 0);
+}
+
+static void
+linux_detach (void)
+{
+ for_each_inferior (&all_threads, linux_detach_one_process);
+}
+
+/* Return nonzero if the given thread is still alive. */
static int
linux_thread_alive (int tid)
{
@@ -1249,6 +1264,7 @@ static struct target_ops linux_target_ops = {
linux_create_inferior,
linux_attach,
linux_kill,
+ linux_detach,
linux_thread_alive,
linux_resume,
linux_wait,