Add attribute::value_as_string method
authorTom Tromey <tom@tromey.com>
Fri, 24 Apr 2020 21:35:01 +0000 (15:35 -0600)
committerTom Tromey <tromey@adacore.com>
Fri, 24 Apr 2020 21:35:02 +0000 (15:35 -0600)
commite61108c92d4bc4021ab89671612308c01b18e15d
tree02aaf1bc391c6ae0754631220fa0e68e55720ca3
parent8c87a4527f5102b124ad0128894b1195d80eef73
Add attribute::value_as_string method

The full DIE reader checks that an attribute has a "string" form in
some spots, but the partial DIE reader does not.  This patch brings
the two readers in sync for one specific case, namely when examining
the linkage name.  This avoids regressions in an existing DWARF test
case.

A full fix for this problem would be preferable.  An accessor like
DW_STRING should always check the form.  However, I haven't attempted
that in this series.

Also the fact that the partial and full readers can disagree like this
is a design flaw.

gdb/ChangeLog
2020-04-24  Tom Tromey  <tom@tromey.com>

* dwarf2/read.c (partial_die_info::read) <case
DW_AT_linkage_name>: Use value_as_string.
(dwarf2_string_attr): Use value_as_string.
* dwarf2/attribute.h (struct attribute) <value_as_string>: Declare
method.
* dwarf2/attribute.c (attribute::value_as_string): New method.
gdb/ChangeLog
gdb/dwarf2/attribute.c
gdb/dwarf2/attribute.h
gdb/dwarf2/read.c
This page took 0.024596 seconds and 4 git commands to generate.