binutils-gdb/gdb/testsuite/gdb.ada
Joel Brobecker a812315168 [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.
2011-09-16 19:09:57 +00:00
..
array_bounds run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
array_return run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
array_subscript_addr run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
arrayidx run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
arrayparam run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
arrayptr extend scope of testing in gdb.ada/arrayptr 2011-04-01 17:03:52 +00:00
atomic_enum run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
call_pn run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
catch_ex run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
char_enum handle character-based enumeration typedefs 2011-07-01 18:25:17 +00:00
char_param run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
complete Add copyright header to some Ada files (testsuite) 2011-01-06 06:27:44 +00:00
cond_lang run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
dyn_loc run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
exec_changed run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
exprs run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
fixed_cmp run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
fixed_points run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
formatted_ref run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
frame_args run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
fun_addr run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
fun_in_declare run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
funcall_param run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
homonym run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
int_deref run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
interface run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
lang_switch run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
mi_catch_ex improve Ada exception catchpoint MI notification 2011-04-01 16:59:58 +00:00
mod_from_name run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
nested run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
null_array run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
null_record Avoid the use of gdb_start_cmd in gdb.ada/*.exp testcases. 2011-01-06 10:33:38 +00:00
packed_array [Ada] Fix unconstrained packed array size 2011-02-17 06:42:57 +00:00
packed_tagged run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
print_chars Add copyright header to some Ada files (testsuite) 2011-01-06 06:27:44 +00:00
ptr_typedef missing type description for typedef to pointer value 2011-07-01 18:26:22 +00:00
ptype_field run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
ptype_tagged_param run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
rec_return run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
ref_param run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
ref_tick_size run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
same_enum treat identical enum types as the same type 2011-07-01 18:26:50 +00:00
start Avoid the use of gdb_start_cmd in gdb.ada/*.exp testcases. 2011-01-06 10:33:38 +00:00
str_ref_cmp run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
sym_print_name gdb/testsuite/ 2011-03-28 20:07:12 +00:00
taft_type run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
tagged run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
tasks run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
tick_last_segv run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
type_coercion run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
uninitialized_vars Avoid the use of gdb_start_cmd in gdb.ada/*.exp testcases. 2011-01-06 10:33:38 +00:00
variant_record_packed_array run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
watch_arg run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
widewide new testcase for Ada Wide Wide Characters and Strings 2011-01-14 19:33:19 +00:00
Makefile.in 2011-02-22 Michael Snyder <msnyder@vmware.com> 2011-02-22 20:52:49 +00:00
array_bounds.exp [testsuite/gdb.ada] simplify some testcases by using clean_restart. 2011-01-06 10:35:00 +00:00
array_return.exp [testsuite/gdb.ada] simplify some testcases by using clean_restart. 2011-01-06 10:35:00 +00:00
array_subscript_addr.exp [testsuite/gdb.ada] simplify some testcases by using clean_restart. 2011-01-06 10:35:00 +00:00
arrayidx.exp [testsuite/gdb.ada] simplify some testcases by using clean_restart. 2011-01-06 10:35:00 +00:00
arrayparam.exp gdb/testsuite/ 2011-03-28 20:07:12 +00:00
arrayptr.exp variables whose type is a typedef to an array pointer 2011-07-01 18:25:49 +00:00
assign_1.exp run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
atomic_enum.exp [testsuite/gdb.ada] simplify some testcases by using clean_restart. 2011-01-06 10:35:00 +00:00
boolean_expr.exp run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
call_pn.exp [testsuite/gdb.ada] simplify some testcases by using clean_restart. 2011-01-06 10:35:00 +00:00
catch_ex.exp bettter display for temporary Ada exception catchpoints 2011-07-01 18:35:36 +00:00
char_enum.exp handle character-based enumeration typedefs 2011-07-01 18:25:17 +00:00
char_param.exp [testsuite/gdb.ada] simplify some testcases by using clean_restart. 2011-01-06 10:35:00 +00:00
complete.exp [testsuite/gdb.ada] simplify some testcases by using clean_restart. 2011-01-06 10:35:00 +00:00
cond_lang.exp run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
dyn_loc.exp run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
exec_changed.exp Avoid the use of gdb_start_cmd in gdb.ada/*.exp testcases. 2011-01-06 10:33:38 +00:00
exprs.exp [testsuite/gdb.ada] simplify some testcases by using clean_restart. 2011-01-06 10:35:00 +00:00
fixed_cmp.exp [testsuite/gdb.ada] simplify some testcases by using clean_restart. 2011-01-06 10:35:00 +00:00
fixed_points.exp [testsuite/gdb.ada] simplify some testcases by using clean_restart. 2011-01-06 10:35:00 +00:00
formatted_ref.exp [testsuite/gdb.ada] simplify some testcases by using clean_restart. 2011-01-06 10:35:00 +00:00
frame_args.exp [testsuite/gdb.ada] simplify some testcases by using clean_restart. 2011-01-06 10:35:00 +00:00
fun_addr.exp [testsuite/gdb.ada] simplify some testcases by using clean_restart. 2011-01-06 10:35:00 +00:00
fun_in_declare.exp [testsuite/gdb.ada] simplify some testcases by using clean_restart. 2011-01-06 10:35:00 +00:00
funcall_param.exp [testsuite/gdb.ada] simplify some testcases by using clean_restart. 2011-01-06 10:35:00 +00:00
gnat_ada.gpr gdb/testsuite/ 2011-01-02 07:32:34 +00:00
homonym.exp [testsuite/gdb.ada] simplify some testcases by using clean_restart. 2011-01-06 10:35:00 +00:00
info_types.c run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
info_types.exp run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
int_deref.exp [testsuite/gdb.ada] simplify some testcases by using clean_restart. 2011-01-06 10:35:00 +00:00
interface.exp [testsuite/gdb.ada] simplify some testcases by using clean_restart. 2011-01-06 10:35:00 +00:00
lang_switch.exp [testsuite/gdb.ada] simplify some testcases by using clean_restart. 2011-01-06 10:35:00 +00:00
mi_catch_ex.exp improve Ada exception catchpoint MI notification 2011-04-01 16:59:58 +00:00
mod_from_name.exp [testsuite/gdb.ada] simplify some testcases by using clean_restart. 2011-01-06 10:35:00 +00:00
nested.exp [testsuite/gdb.ada] simplify some testcases by using clean_restart. 2011-01-06 10:35:00 +00:00
null_array.exp [testsuite/gdb.ada] simplify some testcases by using clean_restart. 2011-01-06 10:35:00 +00:00
null_record.exp [testsuite/gdb.ada] simplify some testcases by using clean_restart. 2011-01-06 10:35:00 +00:00
packed_array.exp Fix printing address of packed array 2011-07-01 18:27:25 +00:00
packed_tagged.exp [testsuite/gdb.ada] simplify some testcases by using clean_restart. 2011-01-06 10:35:00 +00:00
print_chars.exp [testsuite/gdb.ada] simplify some testcases by using clean_restart. 2011-01-06 10:35:00 +00:00
print_pc.exp [testsuite/gdb.ada] simplify some testcases by using clean_restart. 2011-01-06 10:35:00 +00:00
ptr_typedef.exp missing type description for typedef to pointer value 2011-07-01 18:26:22 +00:00
ptype_arith_binop.exp run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
ptype_field.exp [testsuite/gdb.ada] simplify some testcases by using clean_restart. 2011-01-06 10:35:00 +00:00
ptype_tagged_param.exp [testsuite/gdb.ada] simplify some testcases by using clean_restart. 2011-01-06 10:35:00 +00:00
rec_return.exp [testsuite/gdb.ada] simplify some testcases by using clean_restart. 2011-01-06 10:35:00 +00:00
ref_param.exp [testsuite/gdb.ada] simplify some testcases by using clean_restart. 2011-01-06 10:35:00 +00:00
ref_tick_size.exp [testsuite/gdb.ada] simplify some testcases by using clean_restart. 2011-01-06 10:35:00 +00:00
same_enum.exp treat identical enum types as the same type 2011-07-01 18:26:50 +00:00
start.exp 2011-05-16 Pedro Alves <pedro@codesourcery.com> 2011-05-16 13:56:41 +00:00
str_ref_cmp.exp gdb/testsuite/ 2011-03-28 20:07:12 +00:00
sym_print_name.exp gdb/testsuite/ 2011-03-28 20:07:12 +00:00
taft_type.exp [testsuite/gdb.ada] simplify some testcases by using clean_restart. 2011-01-06 10:35:00 +00:00
tagged.exp [testsuite/gdb.ada] simplify some testcases by using clean_restart. 2011-01-06 10:35:00 +00:00
tasks.exp [Ada] Re-implement `info tasks' command using ui-out 2011-09-16 19:09:57 +00:00
tick_last_segv.exp [testsuite/gdb.ada] simplify some testcases by using clean_restart. 2011-01-06 10:35:00 +00:00
type_coercion.exp [testsuite/gdb.ada] simplify some testcases by using clean_restart. 2011-01-06 10:35:00 +00:00
uninitialized_vars.exp [testsuite/gdb.ada] simplify some testcases by using clean_restart. 2011-01-06 10:35:00 +00:00
variant_record_packed_array.exp [testsuite/gdb.ada] simplify some testcases by using clean_restart. 2011-01-06 10:35:00 +00:00
watch_arg.exp [testsuite/gdb.ada] simplify some testcases by using clean_restart. 2011-01-06 10:35:00 +00:00
widewide.exp new testcase for Ada Wide Wide Characters and Strings 2011-01-14 19:33:19 +00:00