aboutsummaryrefslogtreecommitdiff
path: root/gdb/mi
diff options
context:
space:
mode:
authorMarc Khouzam <marc.khouzam@ericsson.com>2010-11-12 18:46:42 +0000
committerMarc Khouzam <marc.khouzam@ericsson.com>2010-11-12 18:46:42 +0000
commitf1b9e6e7ee6f55dd82194417e8f4d1713783ef39 (patch)
tree18ef1c598fdf366c4bb1cb2ec0d717cc86afb88d /gdb/mi
parent74884f7bddd0cddf5d798f9ec6c5d8d8d19d6bfd (diff)
downloadgdb-f1b9e6e7ee6f55dd82194417e8f4d1713783ef39.zip
gdb-f1b9e6e7ee6f55dd82194417e8f4d1713783ef39.tar.gz
gdb-f1b9e6e7ee6f55dd82194417e8f4d1713783ef39.tar.bz2
2010-11-12 Marc Khouzam <marc.khouzam@ericsson.com>
* mi/mi-main.c (mi_cmd_target_detach): Accept new thread-group id format.
Diffstat (limited to 'gdb/mi')
-rw-r--r--gdb/mi/mi-main.c31
1 files changed, 26 insertions, 5 deletions
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 49e913e..3343c03 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -418,19 +418,40 @@ void
mi_cmd_target_detach (char *command, char **argv, int argc)
{
if (argc != 0 && argc != 1)
- error ("Usage: -target-detach [thread-group]");
+ error ("Usage: -target-detach [pid | thread-group]");
if (argc == 1)
{
struct thread_info *tp;
char *end = argv[0];
- int pid = strtol (argv[0], &end, 10);
+ int pid;
- if (*end != '\0')
- error (_("Cannot parse thread group id '%s'"), argv[0]);
+ /* First see if we are dealing with a thread-group id. */
+ if (*argv[0] == 'i')
+ {
+ struct inferior *inf;
+ int id = strtoul (argv[0] + 1, &end, 0);
+
+ if (*end != '\0')
+ error (_("Invalid syntax of thread-group id '%s'"), argv[0]);
+
+ inf = find_inferior_id (id);
+ if (!inf)
+ error (_("Non-existent thread-group id '%d'"), id);
+
+ pid = inf->pid;
+ }
+ else
+ {
+ /* We must be dealing with a pid. */
+ pid = strtol (argv[0], &end, 10);
+
+ if (*end != '\0')
+ error (_("Invalid identifier '%s'"), argv[0]);
+ }
/* Pick any thread in the desired process. Current
- target_detach deteches from the parent of inferior_ptid. */
+ target_detach detaches from the parent of inferior_ptid. */
tp = iterate_over_threads (find_thread_of_process, &pid);
if (!tp)
error (_("Thread group is empty"));