diff options
author | Martin Simmons <qqxnjvamvxwx@dyxyl.com> | 2025-03-27 16:03:45 +0000 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2025-04-03 09:02:40 -0600 |
commit | 1603a80c5cda1f612cda6a32c095ff40d7fca081 (patch) | |
tree | 26e347c20fd1eeab0059dd275abec511ccefaca5 | |
parent | 254809b28f1c9c2a43d25ca1a71a5603d4d1bda6 (diff) | |
download | binutils-1603a80c5cda1f612cda6a32c095ff40d7fca081.zip binutils-1603a80c5cda1f612cda6a32c095ff40d7fca081.tar.gz binutils-1603a80c5cda1f612cda6a32c095ff40d7fca081.tar.bz2 |
Fix parsing .debug_aranges section for signed addresses.
Some architectures, such as MIPS, have signed addresses and this changes
read_addrmap_from_aranges to record them as signed when required.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32658
Approved-By: Tom Tromey <tom@tromey.com>
-rw-r--r-- | gdb/dwarf2/aranges.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/gdb/dwarf2/aranges.c b/gdb/dwarf2/aranges.c index 7016eee..ac530ab 100644 --- a/gdb/dwarf2/aranges.c +++ b/gdb/dwarf2/aranges.c @@ -59,6 +59,7 @@ read_addrmap_from_aranges (dwarf2_per_objfile *per_objfile, gdb::unordered_set<sect_offset> debug_info_offset_seen; const bfd_endian dwarf5_byte_order = gdbarch_byte_order (gdbarch); + const int signed_addr_p = bfd_get_sign_extend_vma (abfd); const gdb_byte *addr = section->buffer; while (addr < section->buffer + section->size) { @@ -167,8 +168,13 @@ read_addrmap_from_aranges (dwarf2_per_objfile *per_objfile, plongest (entry_addr - section->buffer)); return false; } - ULONGEST start = extract_unsigned_integer (addr, address_size, - dwarf5_byte_order); + ULONGEST start; + if (signed_addr_p) + start = extract_signed_integer (addr, address_size, + dwarf5_byte_order); + else + start = extract_unsigned_integer (addr, address_size, + dwarf5_byte_order); addr += address_size; ULONGEST length = extract_unsigned_integer (addr, address_size, dwarf5_byte_order); |