diff options
author | Tom Tromey <tromey@adacore.com> | 2025-02-06 10:49:16 -0700 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2025-03-18 12:40:58 -0600 |
commit | 75de4e21025b01f8167f3acd1e9a010f75ffd631 (patch) | |
tree | f6c21e9716ac4cac6a62294a264dbe33f3c645f1 /gdb | |
parent | a83688465fec197f682e88c223d41468fac12efa (diff) | |
download | binutils-75de4e21025b01f8167f3acd1e9a010f75ffd631.zip binutils-75de4e21025b01f8167f3acd1e9a010f75ffd631.tar.gz binutils-75de4e21025b01f8167f3acd1e9a010f75ffd631.tar.bz2 |
Assume DW_AT_decl_line is unsigned
This changes read_decl_line and new_symbol to assume that
DW_AT_decl_line should refer to an unsigned value.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/dwarf2/read.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index ab68320..e5744eb 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -5947,17 +5947,14 @@ read_decl_line (struct die_info *die, struct dwarf2_cu *cu) struct attribute *decl_line = dwarf2_attr (die, DW_AT_decl_line, cu); if (decl_line == nullptr) return 0; - if (decl_line->form_is_constant ()) - { - LONGEST val = decl_line->constant_value (0); - if (0 <= val && val <= UINT_MAX) - return (unsigned int) val; + std::optional<ULONGEST> val = decl_line->unsigned_constant (); + if (val.has_value ()) + { + if (*val <= UINT_MAX) + return (unsigned int) *val; complaint (_("Declared line for using directive is too large")); - return 0; } - - complaint (_("Declared line for using directive is of incorrect format")); return 0; } @@ -17001,7 +16998,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, inlined_func ? DW_AT_call_line : DW_AT_decl_line, cu); if (attr != nullptr) - sym->set_line (attr->constant_value (0)); + sym->set_line (attr->unsigned_constant ().value_or (0)); struct dwarf2_cu *file_cu = cu; attr = dwarf2_attr (die, |