a812315168
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. |
||
---|---|---|
.. | ||
array_bounds | ||
array_return | ||
array_subscript_addr | ||
arrayidx | ||
arrayparam | ||
arrayptr | ||
atomic_enum | ||
call_pn | ||
catch_ex | ||
char_enum | ||
char_param | ||
complete | ||
cond_lang | ||
dyn_loc | ||
exec_changed | ||
exprs | ||
fixed_cmp | ||
fixed_points | ||
formatted_ref | ||
frame_args | ||
fun_addr | ||
fun_in_declare | ||
funcall_param | ||
homonym | ||
int_deref | ||
interface | ||
lang_switch | ||
mi_catch_ex | ||
mod_from_name | ||
nested | ||
null_array | ||
null_record | ||
packed_array | ||
packed_tagged | ||
print_chars | ||
ptr_typedef | ||
ptype_field | ||
ptype_tagged_param | ||
rec_return | ||
ref_param | ||
ref_tick_size | ||
same_enum | ||
start | ||
str_ref_cmp | ||
sym_print_name | ||
taft_type | ||
tagged | ||
tasks | ||
tick_last_segv | ||
type_coercion | ||
uninitialized_vars | ||
variant_record_packed_array | ||
watch_arg | ||
widewide | ||
array_bounds.exp | ||
array_return.exp | ||
array_subscript_addr.exp | ||
arrayidx.exp | ||
arrayparam.exp | ||
arrayptr.exp | ||
assign_1.exp | ||
atomic_enum.exp | ||
boolean_expr.exp | ||
call_pn.exp | ||
catch_ex.exp | ||
char_enum.exp | ||
char_param.exp | ||
complete.exp | ||
cond_lang.exp | ||
dyn_loc.exp | ||
exec_changed.exp | ||
exprs.exp | ||
fixed_cmp.exp | ||
fixed_points.exp | ||
formatted_ref.exp | ||
frame_args.exp | ||
fun_addr.exp | ||
fun_in_declare.exp | ||
funcall_param.exp | ||
gnat_ada.gpr | ||
homonym.exp | ||
info_types.c | ||
info_types.exp | ||
int_deref.exp | ||
interface.exp | ||
lang_switch.exp | ||
Makefile.in | ||
mi_catch_ex.exp | ||
mod_from_name.exp | ||
nested.exp | ||
null_array.exp | ||
null_record.exp | ||
packed_array.exp | ||
packed_tagged.exp | ||
print_chars.exp | ||
print_pc.exp | ||
ptr_typedef.exp | ||
ptype_arith_binop.exp | ||
ptype_field.exp | ||
ptype_tagged_param.exp | ||
rec_return.exp | ||
ref_param.exp | ||
ref_tick_size.exp | ||
same_enum.exp | ||
start.exp | ||
str_ref_cmp.exp | ||
sym_print_name.exp | ||
taft_type.exp | ||
tagged.exp | ||
tasks.exp | ||
tick_last_segv.exp | ||
type_coercion.exp | ||
uninitialized_vars.exp | ||
variant_record_packed_array.exp | ||
watch_arg.exp | ||
widewide.exp |