Also allow -list-thread-groups (--available) without a live selected thread

Pedro Alves
2009-01-14T14:29:21Z

[-- Attachment #1: Type: text/plain, Size: 703 bytes --]

Similarly to -thread-info, -thread-list-ids, -list-thread-groups (--available)
should always be issuable without a live selected thread.

I tested it in non-stop mode, and all-stop sync/async as well with
success, with an exited thread selected.

In the all-stop async case, '-list-thread-groups' always works,
even if the target is running, because it isn't (currently) asking
the remote side for anything. OTOH, '-list-thread-groups --available' will
error out with "Cannot execute this command while the target is running.",
which is expected due to limitations of the all-stop remote protocol
(same error as given by -thread-info). In non-stop mode, it always
works.

Checked in.

--
Pedro Alves

[-- Attachment #2: list_thread_groups_any_time.diff --]
[-- Type: text/x-diff, Size: 899 bytes --]

2009-01-14 Pedro Alves <pedro@codesourcery.com>

* mi/mi-main.c (mi_cmd_execute): Also allow -list-thread-groups
without a live selected thread.

---
gdb/mi/mi-main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

Index: src/gdb/mi/mi-main.c
===================================================================
--- src.orig/gdb/mi/mi-main.c 2009-01-14 14:15:21.000000000 +0000
+++ src/gdb/mi/mi-main.c 2009-01-14 14:21:03.000000000 +0000
@@ -1355,7 +1355,8 @@ mi_cmd_execute (struct mi_parse *parse)
&& (is_exited (inferior_ptid))
&& (strcmp (parse->command, "thread-info") != 0
&& strcmp (parse->command, "thread-list-ids") != 0
- && strcmp (parse->command, "thread-select") != 0))
+ && strcmp (parse->command, "thread-select") != 0)
+ && strcmp (parse->command, "list-thread-groups") != 0)
{
struct ui_file *stb;
stb = mem_fileopen ();