2010-11-12 Marc Khouzam <marc.khouzam@ericsson.com>

* mi/mi-main.c (mi_cmd_target_detach): Accept new
        thread-group id format.
This commit is contained in:
Marc Khouzam 2010-11-12 18:46:42 +00:00
parent 74884f7bdd
commit f1b9e6e7ee
2 changed files with 31 additions and 5 deletions

View File

@ -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.

View File

@ -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"));