This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
src/gdb ChangeLog ada-lang.c
- From: guitton at sourceware dot org
- To: gdb-cvs at sourceware dot org
- Date: 29 Nov 2012 16:26:14 -0000
- Subject: src/gdb ChangeLog ada-lang.c
CVSROOT: /cvs/src
Module name: src
Changes by: guitton@sourceware.org 2012-11-29 16:26:14
Modified files:
gdb : ChangeLog ada-lang.c
Log message:
Handle other cases than EVAL_NORMAL in the default case
In the evaluation of an expression in Ada mode, the default case
unwraps the argument unconditionally. For an object of a variant
record type, this unwrapping builds a fixed type from the
specification of the variant type and the actual values of the
object's discriminants. It means that unwrapping needs the "proper"
value for the object, not just a zero value with the proper type.
When not in EVAL_NORMAL, we cannot assume that the evaluation returns
such a proper value; it may well return a zero value of the
appropriate type e.g in EVAL_AVOID_SIDE_EFFECTS. It is wrong to try to
unwrap in that case.
In particular, a problem shows up when using expression of the form
{VARIANT_TYPE}OBJ. GDB first evaluates this expression in
EVAL_AVOID_SIDE_EFFECTS to compute the type, the evaluation of OBJ
in most cases returns a zero value of its type, and as UNOP_MEMVAL
is mapped to the default case its evaluation ends up trying to
read memory around address 0.
gdb/ChangeLog:
* ada-lang.c (ada_evaluate_subexp): Unwrap only in EVAL_NORMAL.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.14867&r2=1.14868
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ada-lang.c.diff?cvsroot=src&r1=1.381&r2=1.382