binutils-gdb/gdb/testsuite/gdb.ada
Joel Brobecker f7e44f6574 GDB/MI: crash printing "_task" (Ada) argument
In GDB/MI mode, trying to print the arguments of the frame corresponding
to the body of a task ("-stack-list-arguments 1") causes the debugger to
crash.

This is because the compiler adds an implicit argument to that task body
called "_task". mi/mi-cmd-stack.c:list_args_or_locals, which is
responsible for printing the value of our arguments, finds that our
"_task" symbol is an argument, and thus tries to fing the non-argument
equivalent:

              if (SYMBOL_IS_ARGUMENT (sym))
                sym2 = lookup_symbol (SYMBOL_NATURAL_NAME (sym),
                                      block, VAR_DOMAIN,
                                      (int *) NULL);

Unfortunately, it tries using the natural name, which doesn't always
work for Ada parameters, in particular those who are internally-
generated. In our case, The "_task" parameter's natural name is
"<_task>", and that symbol does not exist.  So sym2 is NULL, thus
causing the crash a little later on when trying to dereference it.
We should be using the symbol linkage name in this case, the same
way iterate_over_block_arg_vars already does.

gdb/ChangeLog:

        * mi/mi-cmd-stack.c (list_args_or_locals): For argument symbols,
        use SYMBOL_LINKAGE_NAME to find the corresponding non-argument
        symbol.  Add assertion that sym2 is never NULL.

gdb/testsuite/ChangeLog:

        * gdb.ada/mi_task_arg: New testcase.
2012-02-03 07:32:40 +00:00
..
array_bounds Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
array_return Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
array_subscript_addr Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
arrayidx Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
arrayparam Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
arrayptr Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
atomic_enum Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
call_pn Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
catch_ex Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
char_enum Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
char_param Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
complete Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
cond_lang Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
dyn_loc Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
exec_changed Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
exprs Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
fixed_cmp Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
fixed_points Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
formatted_ref Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
frame_args Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
fullname_bp Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
fun_addr Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
fun_in_declare Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
funcall_param Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
homonym Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
int_deref Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
interface Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
lang_switch Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
mi_catch_ex Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
mi_task_arg GDB/MI: crash printing "_task" (Ada) argument 2012-02-03 07:32:40 +00:00
mi_task_info Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
mod_from_name Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
nested Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
null_array Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
null_record Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
packed_array Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
packed_tagged Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
print_chars Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
ptr_typedef Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
ptype_field Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
ptype_tagged_param Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
rec_return Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
ref_param Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
ref_tick_size Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
same_enum Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
small_reg_param Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
start Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
str_ref_cmp Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
sym_print_name Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
taft_type Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
tagged Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
task_bp Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
tasks Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
tick_last_segv Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
type_coercion Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
uninitialized_vars Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
variant_record_packed_array Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
watch_arg Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
widewide Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
Makefile.in
array_bounds.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
array_return.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
array_subscript_addr.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
arrayidx.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
arrayparam.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
arrayptr.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
assign_1.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
atomic_enum.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
boolean_expr.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
call_pn.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
catch_ex.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
char_enum.exp Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
char_param.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
complete.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
cond_lang.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
dyn_loc.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
exec_changed.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
exprs.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
fixed_cmp.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
fixed_points.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
formatted_ref.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
frame_args.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
fullname_bp.exp Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
fun_addr.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
fun_in_declare.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
funcall_param.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
gnat_ada.gpr Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
homonym.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
info_types.c Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
info_types.exp Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
int_deref.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
interface.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
lang_switch.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
mi_catch_ex.exp Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
mi_task_arg.exp GDB/MI: crash printing "_task" (Ada) argument 2012-02-03 07:32:40 +00:00
mi_task_info.exp 2012-01-18 Pedro Alves <palves@redhat.com> 2012-01-18 17:00:17 +00:00
mod_from_name.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
nested.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
null_array.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
null_record.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
packed_array.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
packed_tagged.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
print_chars.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
print_pc.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
ptr_typedef.exp Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
ptype_arith_binop.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
ptype_field.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
ptype_tagged_param.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
rec_return.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
ref_param.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
ref_tick_size.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
same_enum.exp Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
small_reg_param.exp Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
start.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
str_ref_cmp.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
sym_print_name.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
taft_type.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
tagged.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
task_bp.exp Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
tasks.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
tick_last_segv.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
type_coercion.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
uninitialized_vars.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
variant_record_packed_array.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
watch_arg.exp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
widewide.exp Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00