diff options
author | Joel Brobecker <brobecker@gnat.com> | 2011-09-16 19:09:57 +0000 |
---|---|---|
committer | Joel Brobecker <brobecker@gnat.com> | 2011-09-16 19:09:57 +0000 |
commit | a812315168b939c0acca896a4975aa9044e55322 (patch) | |
tree | 6dedead8aab7982f971106fa01a10d65683b10c7 /gdb/testsuite | |
parent | fbf06824138b9819662569ea6d136e70c00ec9b1 (diff) | |
download | fsf-binutils-gdb-a812315168b939c0acca896a4975aa9044e55322.zip fsf-binutils-gdb-a812315168b939c0acca896a4975aa9044e55322.tar.gz fsf-binutils-gdb-a812315168b939c0acca896a4975aa9044e55322.tar.bz2 |
[Ada] Re-implement `info tasks' command using ui-out
This is in preparation for providing a GDB/MI equivalent of
the `info tasks' command. The previous implementation was using
various printf commands to generate the command output, which
does not work at all if we want to use that same code to generate
the result for that new GDB/MI command.
This patch thus re-implements the `info tasks' command (with no
arguments) in a way that makes it GDB/MI friendly.
There is an additional hicup, which is the fact that the `info tasks'
command displays a completely different type of output when a task
ID is given. For instance:
(gdb) info task 2
Ada Task: 0x644d20
Name: my_callee
Thread: 0
LWP: 0x5809
Parent: 1 (main_task)
Base Priority: 48
State: Blocked in accept or select with terminate
The above output is better when in CLI mode, but really not
what we want when in GDB/MI mode. In GDB/MI mode, we want to
follow what the `-thread-info' command does when a task-id
is given as an argument, which is to produce the same table,
but with only one element/task in it.
For compatibility as well as practical reasons, we do not want
to change the output of the `info task TASKNO' command when in
CLI mode. But it's easy to preserve this behavior while providing
the desirable output when in GDB/MI mode. For this, the function
used to generated the `info tasks' output has been enhanced to take
an argument interpreted as a string. The CLI command knows to never
provide that argument, while the GDB/MI command will pass one if
provided by the user.
gdb/ChangeLog:
* ada-tasks.c (print_ada_task_info): New function, merging
short_task_info and info_tasks together. Reimplement using
ui-out instead of printing to stdout directly. Move the code
building and checking the task list here, instead of leaving it
in info_tasks_command.
(info_task): Move the code building and checking the task
list here, instead of leaving it in info_tasks_command.
(info_tasks_command): Delete code building and checking
the task list - moved elsewhere. Update calls to info_tasks
and info_task.
One of the minor changes the switch caused is the introduction
of a space between the "current" column, and the task "ID"
column, which wasn't there before. This matches what we do
in the "info threads" command, so I kept that change. This
required an adjustment in the testsuite, however...
gdb/testsuite/ChangeLog:
* gdb.ada/tasks.exp: Make the expected output for
the `info tasks' tests more resilient to spacing
changes.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/testsuite/gdb.ada/tasks.exp | 20 |
2 files changed, 16 insertions, 10 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 99e220c..7222a2d 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2011-09-16 Joel Brobecker <brobecker@adacore.com> + + * gdb.ada/tasks.exp: Make the expected output for + the `info tasks' tests more resilient to spacing + changes. + 2011-09-16 Jan Kratochvil <jan.kratochvil@redhat.com> * gdb.python/py-evthreads.exp (Run to breakpoint 1) diff --git a/gdb/testsuite/gdb.ada/tasks.exp b/gdb/testsuite/gdb.ada/tasks.exp index 1ba1bb8..17dd2b8 100644 --- a/gdb/testsuite/gdb.ada/tasks.exp +++ b/gdb/testsuite/gdb.ada/tasks.exp @@ -37,11 +37,11 @@ runto "foo.adb:$bp_location" # Make sure that all tasks appear in the "info tasks" listing, and # that the active task is the environment task. gdb_test "info tasks" \ - [join {" ID TID P-ID Pri State Name" \ - "\\* 1 .* main_task" \ - " 2 .* task_list\\(1\\)" \ - " 3 .* task_list\\(2\\)" \ - " 4 .* task_list\\(3\\)"} \ + [join {" +ID +TID P-ID Pri State +Name" \ + "\\* +1 .* main_task" \ + " +2 .* task_list\\(1\\)" \ + " +3 .* task_list\\(2\\)" \ + " +4 .* task_list\\(3\\)"} \ "\r\n"] \ "info tasks before inserting breakpoint" @@ -59,11 +59,11 @@ gdb_test "continue" \ # Check that it is indeed task 3 that hit the breakpoint by checking # which is the active task. gdb_test "info tasks" \ - [join {" ID TID P-ID Pri State Name" \ - " 1 .* main_task" \ - " 2 .* task_list\\(1\\)" \ - "\\* 3 .* task_list\\(2\\)" \ - " 4 .* task_list\\(3\\)"} \ + [join {" +ID +TID P-ID Pri State +Name" \ + " +1 .* main_task" \ + " +2 .* task_list\\(1\\)" \ + "\\* +3 .* task_list\\(2\\)" \ + " +4 .* task_list\\(3\\)"} \ "\r\n"] \ "info tasks after hitting breakpoint" |