Skip to content

Commit 6967933

Browse files
committed
Use attribute::unsigned_constant for DW_AT_data_member_location
This changes the DWARF reader to use attribute::unsigned_constant for DW_AT_data_member_location. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32680
1 parent dbcdce7 commit 6967933

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

gdb/dwarf2/read.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9923,7 +9923,7 @@ handle_member_location (struct die_info *die, struct dwarf2_cu *cu,
99239923
so if we see it, we can assume that a constant form is really
99249924
a constant and not a section offset. */
99259925
if (attr->form_is_constant ())
9926-
*offset = attr->constant_value (0);
9926+
*offset = attr->unsigned_constant ().value_or (0);
99279927
else if (attr->form_is_section_offset ())
99289928
dwarf2_complex_location_expr_complaint ();
99299929
else if (attr->form_is_block ()
@@ -9963,7 +9963,7 @@ handle_member_location (struct die_info *die, struct dwarf2_cu *cu,
99639963
{
99649964
if (attr->form_is_constant ())
99659965
{
9966-
LONGEST offset = attr->constant_value (0);
9966+
LONGEST offset = attr->unsigned_constant ().value_or (0);
99679967

99689968
/* Work around this GCC 11 bug, where it would erroneously use -1
99699969
data member locations, instead of 0:
@@ -12288,7 +12288,7 @@ mark_common_block_symbol_computed (struct symbol *sym,
1228812288

1228912289
if (member_loc->form_is_constant ())
1229012290
{
12291-
offset = member_loc->constant_value (0);
12291+
offset = member_loc->unsigned_constant ().value_or (0);
1229212292
baton->size += 1 /* DW_OP_addr */ + cu->header.addr_size;
1229312293
}
1229412294
else

0 commit comments

Comments
 (0)