Fix handling of typedefs to types having a data_location attribute.
authorJoel Brobecker <brobecker@adacore.com>
Wed, 20 Aug 2014 12:50:38 +0000 (14:50 +0200)
committerJoel Brobecker <brobecker@adacore.com>
Wed, 20 Aug 2014 13:34:19 +0000 (15:34 +0200)
commitd36430db79dc8eccb9cb188e1234f7ff044f79b4
tree68e68772d4683574eb6a07da98b4a64d190d30c1
parent000339af7b74593f4dd3a679427b9fe34d1254f7
Fix handling of typedefs to types having a data_location attribute.

Consider an array described in the debugging information as being
a typedef of an array type for which there is a DW_AT_data_location
attribute. Trying to print the value of that array currently yields
incorrect element values. For instance:

    (gdb) print foo.three_tdef
    $1 = (6293760, 0, 6293772)

The problem occurs because we check for the data_location attribute
only on the typedef type, whereas we should be checking for the
typedef's target type.  As a result, GDB erroneously thinks that
there is no data_location, and therefore starts reading the array's
content from the address of the descriptor instead of the data_location
address.

gdb/ChangeLog:

        * value.c (value_from_contents_and_address): Strip resolved_type's
        typedef layers before checking its TYPE_DATA_LOCATION.

gdb/testsuite/ChangeLog:

        * gdb.dwarf2/data-loc.exp: Add additional tests exercising
        the handling of variables declared as a typedef to an array
        which a DW_AT_data_location attribute.
gdb/ChangeLog
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.dwarf2/data-loc.exp
gdb/value.c
This page took 0.02616 seconds and 4 git commands to generate.