This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
src/gdb ChangeLog ada-lang.c testsuite/ChangeL ...
- From: brobecke at sourceware dot org
- To: gdb-cvs at sourceware dot org
- Date: 10 Sep 2012 22:18:24 -0000
- Subject: src/gdb ChangeLog ada-lang.c testsuite/ChangeL ...
CVSROOT: /cvs/src
Module name: src
Changes by: brobecke@sourceware.org 2012-09-10 22:18:24
Modified files:
gdb : ChangeLog ada-lang.c
gdb/testsuite : ChangeLog
Added files:
gdb/testsuite/gdb.ada: optim_drec.exp
gdb/testsuite/gdb.ada/optim_drec: foo.adb
Log message:
crash printing optimized out variant type
Assuming the following declarations:
type Discriminants_Record (A : Integer; B : Boolean) is record
C : Float;
end record;
Z : Discriminants_Record := (A => 1, B => False, C => 2.0);
If variable Z is not used, and the compiler optimizes it out,
GDB would crash as follow:
(gdb) print Z
/[...]/gdb/valops.c:1121: internal-error: Unexpected lazy value type.
This is because the ada-lang module forgot to set the optimized_out
flag in the value returned by ada_evaluate_subexp during the value's
"fixing" process. Later on, when trying to print the resulting value,
GDB finds that the value is still lazily allocated, and thus tries to
fetch it. But this is not allowed for not_lval values, hence the internal
error.
gdb/ChangeLog:
* ada-lang.c (coerce_unspec_val_to_type): Make sure that
the optimized_out flag is preserved.
gdb/testsuite/ChangeLog:
* gdb.ada/optim_drec: New testcase.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.14647&r2=1.14648
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ada-lang.c.diff?cvsroot=src&r1=1.375&r2=1.376
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/ChangeLog.diff?cvsroot=src&r1=1.3364&r2=1.3365
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.ada/optim_drec.exp.diff?cvsroot=src&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.ada/optim_drec/foo.adb.diff?cvsroot=src&r1=NONE&r2=1.1