diff options
author | Tom Tromey <tromey@adacore.com> | 2020-04-24 13:40:31 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2020-04-24 13:40:32 -0600 |
commit | 7d79de9a4be2d1abb0320c322967f1aad39b1f7d (patch) | |
tree | fa576d23c30849b3b5eeda590d1ce1b8094ac791 /gdb/testsuite/ChangeLog | |
parent | f8e89861cfb6acbfa097814f5864afd5563a3011 (diff) | |
download | gdb-7d79de9a4be2d1abb0320c322967f1aad39b1f7d.zip gdb-7d79de9a4be2d1abb0320c322967f1aad39b1f7d.tar.gz gdb-7d79de9a4be2d1abb0320c322967f1aad39b1f7d.tar.bz2 |
Add support for variable field offsets
In Ada, a field can have a variable offset. This patch adds support
for this case to gdb, using the existing dynamic type resolution code.
Doing just this, though, would break C++ virtual base handling.
It turns out that virtual base handling only worked by the ugliest of
hacks. In particular, the DWARF reader would call decode_locdesc for
a virtual base location. Here's an example of such an expression from
gdb's m-static test case:
<241> DW_AT_data_member_location: 6 byte block: 12 6 48 1c 6 22 (DW_OP_dup; DW_OP_deref; DW_OP_lit24; DW_OP_minus; DW_OP_deref; DW_OP_plus)
When examining this, decode_locdesc would treat DW_OP_deref as a no-op
and compute some answer (here, -24). This would be stored as the
offset.
Later, in gnu-v3-abi.c, the real offset would be computed by digging
around in the vtable.
This patch cleans up this area. In particular, it now evaluates the
location expression on demand.
Note there is a new FIXME in gnu-v3-abi.c. I think some of the
callers are incorrect here, and have only worked because this member
is unused. I will file a bug for this. I didn't fix this problem in
this series because I felt it was already too complex.
gdb/ChangeLog
2020-04-24 Tom Tromey <tromey@adacore.com>
* dwarf2/read.c (handle_data_member_location): New overload.
(dwarf2_add_field): Use it.
(decode_locdesc): Add "computed" parameter. Update comment.
* gdbtypes.c (is_dynamic_type_internal): Also look for
FIELD_LOC_KIND_DWARF_BLOCK.
(resolve_dynamic_struct): Handle FIELD_LOC_KIND_DWARF_BLOCK.
* gdbtypes.c (is_dynamic_type_internal): Add special case for C++
virtual base classes.
* gnu-v3-abi.c (gnuv3_baseclass_offset): Handle
FIELD_LOC_KIND_DWARF_BLOCK.
gdb/testsuite/ChangeLog
2020-04-24 Tom Tromey <tromey@adacore.com>
* gdb.ada/variant.exp: Add dynamic field offset tests.
* gdb.ada/variant/pck.ads (Nested_And_Variable): New type.
* gdb.ada/variant/pkg.adb: Add new variables.
Diffstat (limited to 'gdb/testsuite/ChangeLog')
-rw-r--r-- | gdb/testsuite/ChangeLog | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 6664700..4e7dfac 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,11 @@ 2020-04-24 Tom Tromey <tromey@adacore.com> + * gdb.ada/variant.exp: Add dynamic field offset tests. + * gdb.ada/variant/pck.ads (Nested_And_Variable): New type. + * gdb.ada/variant/pkg.adb: Add new variables. + +2020-04-24 Tom Tromey <tromey@adacore.com> + * gdb.ada/variant.exp: New file * gdb.ada/variant/pkg.adb: New file * gdb.ada/variant/pck.adb: New file |