* [RFC] Implement 'detach pid'.
@ 2008-07-05 17:05 Vladimir Prus
2008-07-05 17:13 ` Vladimir Prus
2008-07-05 17:21 ` Tom Tromey
0 siblings, 2 replies; 4+ messages in thread
From: Vladimir Prus @ 2008-07-05 17:05 UTC (permalink / raw)
To: gdb-patches
As Marc has noted, -target-detach does not accept a pid to detach from,
and CLI detach does not accept pid either. This patch fixes it. Does it
look OK?
- Volodya
* infcmd.c (_initialize_infcmd): Make 'detach' accept
parameter.
* mi/mi-cmds.c (mi_cmds): Make '-target-detach' pass parameter
to 'detach'.
* remote.c (remote_detach_1): Interpret the passed
parameter as a pid to detach from.
---
gdb/infcmd.c | 2 +-
gdb/mi/mi-cmds.c | 2 +-
gdb/remote.c | 13 +++++++++++--
3 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index e650789..dcdaa7f 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -2250,7 +2250,7 @@ to specify the program, and to load its symbol table."));
Detach a process or file previously attached.\n\
If a process, it is no longer traced, and it continues its execution. If\n\
you were debugging a file, the file is closed and gdb no longer accesses it."),
- &detachlist, "detach ", 0, &cmdlist);
+ &detachlist, "detach ", 1, &cmdlist);
add_com ("disconnect", class_run, disconnect_command, _("\
Disconnect from a target.\n\
diff --git a/gdb/mi/mi-cmds.c b/gdb/mi/mi-cmds.c
index 68c5353..b9c4f8e 100644
--- a/gdb/mi/mi-cmds.c
+++ b/gdb/mi/mi-cmds.c
@@ -120,7 +120,7 @@ struct mi_cmd mi_cmds[] =
{ "symbol-type", { NULL, 0 }, NULL },
{ "target-attach", { "attach", 1 }, NULL },
{ "target-compare-sections", { NULL, 0 }, NULL },
- { "target-detach", { "detach", 0 }, 0 },
+ { "target-detach", { "detach", 1 }, 0 },
{ "target-disconnect", { "disconnect", 0 }, 0 },
{ "target-download", { NULL, 0 }, mi_cmd_target_download},
{ "target-exec-status", { NULL, 0 }, NULL },
diff --git a/gdb/remote.c b/gdb/remote.c
index 51b8ec5..d8a7500 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -2917,11 +2917,20 @@ remote_open_1 (char *name, int from_tty, struct target_ops *target, int extended
static void
remote_detach_1 (char *args, int from_tty, int extended)
{
- int pid = ptid_get_pid (inferior_ptid);
+ int pid;
struct remote_state *rs = get_remote_state ();
if (args)
- error (_("Argument given to \"detach\" when remotely debugging."));
+ {
+ char *end = args;
+ pid = strtol (args, &end, 10);
+ if (*end != '\0')
+ error (_("Cannot parse process id '%s'"), args);
+ if (!in_process_list (pid))
+ error (_("Invalid process id %d"), pid);
+ }
+ else
+ pid = ptid_get_pid (inferior_ptid);
if (!target_has_execution)
error (_("No process to detach from."));
--
1.5.3.5
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC] Implement 'detach pid'.
2008-07-05 17:05 [RFC] Implement 'detach pid' Vladimir Prus
@ 2008-07-05 17:13 ` Vladimir Prus
2008-07-05 17:21 ` Tom Tromey
1 sibling, 0 replies; 4+ messages in thread
From: Vladimir Prus @ 2008-07-05 17:13 UTC (permalink / raw)
To: gdb-patches
Vladimir Prus wrote:
>
> As Marc has noted, -target-detach does not accept a pid to detach from,
> and CLI detach does not accept pid either. This patch fixes it. Does it
> look OK?
Doh! This patch was not meant for gdb-patches, as the pre-requisite patch
allowing GDB to attach to more that one process is not submitted yet.
Sorry for the noise,
Volodya
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC] Implement 'detach pid'.
2008-07-05 17:05 [RFC] Implement 'detach pid' Vladimir Prus
2008-07-05 17:13 ` Vladimir Prus
@ 2008-07-05 17:21 ` Tom Tromey
2008-07-06 6:24 ` Eli Zaretskii
1 sibling, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2008-07-05 17:21 UTC (permalink / raw)
To: Vladimir Prus; +Cc: gdb-patches
>>>>> "Vladimir" == Vladimir Prus <vladimir@codesourcery.com> writes:
Vladimir> As Marc has noted, -target-detach does not accept a pid to
Vladimir> detach from, and CLI detach does not accept pid either. This
Vladimir> patch fixes it. Does it look OK?
Channelling Eli here ... it needs a documentation update and perhaps a
NEWS entry :-)
Tom
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC] Implement 'detach pid'.
2008-07-05 17:21 ` Tom Tromey
@ 2008-07-06 6:24 ` Eli Zaretskii
0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2008-07-06 6:24 UTC (permalink / raw)
To: tromey; +Cc: vladimir, gdb-patches
> Cc: gdb-patches@sources.redhat.com
> From: Tom Tromey <tromey@redhat.com>
> Reply-To: tromey@redhat.com
> Date: Sat, 05 Jul 2008 11:21:03 -0600
>
> >>>>> "Vladimir" == Vladimir Prus <vladimir@codesourcery.com> writes:
>
> Vladimir> As Marc has noted, -target-detach does not accept a pid to
> Vladimir> detach from, and CLI detach does not accept pid either. This
> Vladimir> patch fixes it. Does it look OK?
>
> Channelling Eli here
Thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-07-06 6:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-05 17:05 [RFC] Implement 'detach pid' Vladimir Prus
2008-07-05 17:13 ` Vladimir Prus
2008-07-05 17:21 ` Tom Tromey
2008-07-06 6:24 ` Eli Zaretskii
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox