aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2/attribute.h
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2020-09-29 18:49:08 -0600
committerTom Tromey <tom@tromey.com>2020-09-29 20:29:07 -0600
commitd4df075e8b946da354dc11690a793cf5c17394aa (patch)
tree4c83c093d28cdb13a977411cd2b0d7a753023439 /gdb/dwarf2/attribute.h
parentbf23a26804608145c316c7516b1aceecc055a888 (diff)
downloadgdb-d4df075e8b946da354dc11690a793cf5c17394aa.zip
gdb-d4df075e8b946da354dc11690a793cf5c17394aa.tar.gz
gdb-d4df075e8b946da354dc11690a793cf5c17394aa.tar.bz2
Add attribute::as_unsigned method
This introduces a new attribute::as_unsigned method and changes a few spots to use it. gdb/ChangeLog 2020-09-29 Tom Tromey <tom@tromey.com> * dwarf2/read.c (dw2_get_file_names_reader) (dwarf2_build_include_psymtabs, handle_DW_AT_stmt_list) (dwarf2_cu::setup_type_unit_groups, fill_in_loclist_baton) (dwarf2_symbol_mark_computed): Use as_unsigned. * dwarf2/attribute.h (struct attribute) <as_unsigned>: New method. <form_is_section_offset>: Update comment.
Diffstat (limited to 'gdb/dwarf2/attribute.h')
-rw-r--r--gdb/dwarf2/attribute.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/gdb/dwarf2/attribute.h b/gdb/dwarf2/attribute.h
index cb25208..c2e14ef 100644
--- a/gdb/dwarf2/attribute.h
+++ b/gdb/dwarf2/attribute.h
@@ -82,9 +82,18 @@ struct attribute
return u.unsnd;
}
+ /* Return the unsigned value. Requires that the form be an unsigned
+ form, and that reprocessing not be needed. */
+ ULONGEST as_unsigned () const
+ {
+ gdb_assert (form_is_unsigned ());
+ gdb_assert (!requires_reprocessing);
+ return u.unsnd;
+ }
+
/* Return non-zero if ATTR's value is a section offset --- classes
lineptr, loclistptr, macptr or rangelistptr --- or zero, otherwise.
- You may use DW_UNSND (attr) to retrieve such offsets.
+ You may use the as_unsigned method to retrieve such offsets.
Section 7.5.4, "Attribute Encodings", explains that no attribute
may have a value that belongs to more than one of these classes; it