This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
src/gdb ChangeLog ada-lang.c value.c value.h
- From: brobecke at sourceware dot org
- To: gdb-cvs at sourceware dot org
- Date: Wed, 10 Jul 2013 00:34:38 +0000
- Subject: src/gdb ChangeLog ada-lang.c value.c value.h
CVSROOT: /cvs/src
Module name: src
Changes by: brobecke@sourceware.org 2013-07-10 00:34:38
Modified files:
gdb : ChangeLog ada-lang.c value.c value.h
Log message:
ada-lang.c:coerce_unspec_val_to_type: Preserve laziness.
ada-lang.c:coerce_unspec_val_to_type does:
if (value_lazy (val)
|| TYPE_LENGTH (type) > TYPE_LENGTH (value_type (val)))
result = allocate_value_lazy (type);
else
{
result = allocate_value (type);
memcpy (value_contents_raw (result), value_contents (val),
TYPE_LENGTH (type));
}
set_value_component_location (result, val);
set_value_bitsize (result, value_bitsize (val));
set_value_bitpos (result, value_bitpos (val));
set_value_address (result, value_address (val));
set_value_optimized_out (result, value_optimized_out (val));
Notice that before value_optimized_out was made to auto-fetch lazy
values, VAL would end up still lazy if it was lazy on entry. It's not
really a problem here if VAL is lazy, and VAL->optimized_out is 0,
because RESULT is also left lazy. IOW, this just wants to copy the
VAL->optimized_out flag to RESULT->optimized_out, nothing else.
As a side-effect of the change in value_optimized_out, the following
testcase now regresses. Consider:
type Small is range -64 .. 63;
for Small'Size use 7;
type Arr is array (1..10) of Small;
pragma Pack (Arr);
type Arr_Ptr is access Arr;
An_Arr_Ptr : Arr_Ptr := new Arr'(10, 20, 30, 40, 50, 60, 62, 63,
-23, 42);
Trying to print one element of An_Arr_Ptr yields:
(gdb) p an_arr_ptr(3)
Cannot access memory at address 0x0
The patch adds the value_optimized_out_const function for that,
allowing us to avoid trying to fetch a value at a dummy address.
(I found this out by grepping for set_value_optimized_out and trying
to convert the uses I found to instead allocate the value with
allocate_optimized_out_value.)
Tested on x86_64 Fedora 17.
gdb/
2013-07-09 Pedro Alves <palves@redhat.com>
* ada-lang.c (coerce_unspec_val_to_type): Use
value_optimized_out_const.
* value.c (value_optimized_out_const): New function.
* value.h (value_optimized_out_const): New declaration.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.15793&r2=1.15794
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ada-lang.c.diff?cvsroot=src&r1=1.404&r2=1.405
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/value.c.diff?cvsroot=src&r1=1.175&r2=1.176
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/value.h.diff?cvsroot=src&r1=1.221&r2=1.222