old-cross-binutils/gdb/mi
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
..
ChangeLog-1999-2003
mi-cmd-break.c Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
mi-cmd-disas.c Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
mi-cmd-env.c Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
mi-cmd-file.c Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
mi-cmd-stack.c GDB/MI: crash printing "_task" (Ada) argument 2012-02-03 07:32:40 +00:00
mi-cmd-target.c Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
mi-cmd-var.c Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
mi-cmds.c Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
mi-cmds.h Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
mi-common.c 2012-01-11 Andreas Tobler <andreast@fgznet.ch> 2012-01-11 21:51:31 +00:00
mi-common.h Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
mi-console.c Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
mi-console.h Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
mi-getopt.c Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
mi-getopt.h Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
mi-interp.c 2012-01-06 Sergio Durigan Junior <sergiodj@redhat.com> 2012-01-06 03:34:46 +00:00
mi-main.c Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
mi-main.h Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
mi-out.c Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
mi-out.h Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
mi-parse.c Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
mi-parse.h Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00
mi-symbol-cmds.c Copyright year update in most files of the GDB Project. 2012-01-04 08:17:56 +00:00