binutils-gdb/gdb/testsuite
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
..
boards 2012-01-27 Pedro Alves <palves@redhat.com> 2012-01-27 13:02:22 +00:00
config 2012-01-27 Pedro Alves <palves@redhat.com> 2012-01-27 13:02:22 +00:00
gdb.ada GDB/MI: crash printing "_task" (Ada) argument 2012-02-03 07:32:40 +00:00
gdb.arch 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
gdb.asm 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
gdb.base 2012-02-02 Pedro Alves <palves@redhat.com> 2012-02-02 18:07:58 +00:00
gdb.cell Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
gdb.cp PR gdb/9307: 2012-02-02 14:58:33 +00:00
gdb.disasm 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
gdb.dwarf2 gdb/testsuite/ 2012-01-14 10:46:35 +00:00
gdb.fortran 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
gdb.gdb 2012-02-02 Pedro Alves <palves@redhat.com> 2012-02-02 18:09:07 +00:00
gdb.hp 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
gdb.java 2012-01-19 Pedro Alves <palves@redhat.com> 2012-01-19 12:37:28 +00:00
gdb.linespec gdb 2012-01-16 20:40:53 +00:00
gdb.mi gdb/testsuite/ 2012-01-24 20:35:35 +00:00
gdb.modula2 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
gdb.multi 2012-01-26 Pedro Alves <palves@redhat.com> 2012-01-26 10:09:43 +00:00
gdb.objc 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
gdb.opencl 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
gdb.opt 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
gdb.pascal 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
gdb.python 2012-01-20 Pedro Alves <palves@redhat.com> 2012-01-20 20:00:14 +00:00
gdb.reverse 2012-02-02 Pedro Alves <palves@redhat.com> 2012-02-02 18:10:07 +00:00
gdb.server Copyright year update in most files of the GDB Project. 2012-01-04 08:28:28 +00:00
gdb.stabs 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
gdb.threads gdb/ 2012-01-24 13:46:55 +00:00
gdb.trace 2012-01-16 Pedro Alves <palves@redhat.com> 2012-01-16 16:21:53 +00:00
gdb.xml Copyright year update in most files of the GDB Project. 2012-01-04 08:28:28 +00:00
lib 2012-01-27 Pedro Alves <palves@redhat.com> 2012-01-27 13:02:22 +00:00
aclocal.m4
ChangeLog GDB/MI: crash printing "_task" (Ada) argument 2012-02-03 07:32:40 +00:00
configure the "ambiguous linespec" series 2011-12-06 18:54:43 +00:00
configure.ac Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
dg-extract-results.sh Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
Makefile.in Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
TODO