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:
parent
74884f7bdd
commit
f1b9e6e7ee
|
@ -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>
|
2010-11-12 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||||
|
|
||||||
* spu-tdep.c (spu_catch_start): Fix compilation error typo.
|
* spu-tdep.c (spu_catch_start): Fix compilation error typo.
|
||||||
|
|
|
@ -418,19 +418,40 @@ void
|
||||||
mi_cmd_target_detach (char *command, char **argv, int argc)
|
mi_cmd_target_detach (char *command, char **argv, int argc)
|
||||||
{
|
{
|
||||||
if (argc != 0 && argc != 1)
|
if (argc != 0 && argc != 1)
|
||||||
error ("Usage: -target-detach [thread-group]");
|
error ("Usage: -target-detach [pid | thread-group]");
|
||||||
|
|
||||||
if (argc == 1)
|
if (argc == 1)
|
||||||
{
|
{
|
||||||
struct thread_info *tp;
|
struct thread_info *tp;
|
||||||
char *end = argv[0];
|
char *end = argv[0];
|
||||||
int pid = strtol (argv[0], &end, 10);
|
int pid;
|
||||||
|
|
||||||
if (*end != '\0')
|
/* First see if we are dealing with a thread-group id. */
|
||||||
error (_("Cannot parse thread group id '%s'"), argv[0]);
|
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
|
/* 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);
|
tp = iterate_over_threads (find_thread_of_process, &pid);
|
||||||
if (!tp)
|
if (!tp)
|
||||||
error (_("Thread group is empty"));
|
error (_("Thread group is empty"));
|
||||||
|
|
Loading…
Reference in New Issue