diff options
Diffstat (limited to 'gdb/dwarf2/attribute.c')
-rw-r--r-- | gdb/dwarf2/attribute.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/gdb/dwarf2/attribute.c b/gdb/dwarf2/attribute.c index 8ff0353..d2b5364 100644 --- a/gdb/dwarf2/attribute.c +++ b/gdb/dwarf2/attribute.c @@ -216,6 +216,22 @@ attribute::signed_constant () const /* See attribute.h. */ +std::optional<LONGEST> +attribute::confused_constant () const +{ + if (form_is_strictly_signed ()) + return u.snd; + else if (form_is_constant ()) + return u.unsnd; + + /* For DW_FORM_data16 see attribute::form_is_constant. */ + complaint (_("Attribute value is not a constant (%s)"), + dwarf_form_name (form)); + return {}; +} + +/* See attribute.h. */ + bool attribute::form_is_unsigned () const { |