This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
src/gdb ChangeLog mi/mi-cmd-stack.c testsuite/ ...
- From: brobecke at sourceware dot org
- To: gdb-cvs at sourceware dot org
- Date: 3 Feb 2012 07:32:40 -0000
- Subject: src/gdb ChangeLog mi/mi-cmd-stack.c testsuite/ ...
CVSROOT: /cvs/src
Module name: src
Changes by: brobecke@sourceware.org 2012-02-03 07:32:40
Modified files:
gdb : ChangeLog
gdb/mi : mi-cmd-stack.c
gdb/testsuite : ChangeLog
Added files:
gdb/testsuite/gdb.ada: mi_task_arg.exp
gdb/testsuite/gdb.ada/mi_task_arg: task_switch.adb
Log message:
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.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.13804&r2=1.13805
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/mi/mi-cmd-stack.c.diff?cvsroot=src&r1=1.61&r2=1.62
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/ChangeLog.diff?cvsroot=src&r1=1.3059&r2=1.3060
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.ada/mi_task_arg.exp.diff?cvsroot=src&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.ada/mi_task_arg/task_switch.adb.diff?cvsroot=src&r1=NONE&r2=1.1