aboutsummaryrefslogtreecommitdiff
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
parent74884f7bddd0cddf5d798f9ec6c5d8d8d19d6bfd (diff)
downloadbinutils-f1b9e6e7ee6f55dd82194417e8f4d1713783ef39.zip
binutils-f1b9e6e7ee6f55dd82194417e8f4d1713783ef39.tar.gz
binutils-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.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/mi/mi-main.c31
2 files changed, 31 insertions, 5 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 5006250..567b54b 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2010-11-12 Marc Khouzam <marc.khouzam@ericsson.com>
+
+ * mi/mi-main.c (mi_cmd_target_detach): Accept new
+ thread-group id format.
+
2010-11-12 Jan Kratochvil <jan.kratochvil@redhat.com>
* spu-tdep.c (spu_catch_start): Fix compilation error typo.
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"));