diff options
author | Tom Tromey <tom@tromey.com> | 2023-12-10 14:16:06 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2024-01-08 18:40:21 -0700 |
commit | 8e279fda0f725500c8f84a8b2ed56b0ee8d00ce0 (patch) | |
tree | 266a39de85287280db4ad3a9cc77f3eaf3c5b384 /gdb/dwarf2/aranges.c | |
parent | 54b815ddb428944a70694e3767a0fadbdd9ca9ea (diff) | |
download | gdb-8e279fda0f725500c8f84a8b2ed56b0ee8d00ce0.zip gdb-8e279fda0f725500c8f84a8b2ed56b0ee8d00ce0.tar.gz gdb-8e279fda0f725500c8f84a8b2ed56b0ee8d00ce0.tar.bz2 |
Add deferred_warnings parameter to read_addrmap_from_aranges
When DWARF reading is done in the background,
read_addrmap_from_aranges will be called from a worker thread.
Because warnings can't be emitted from these threads, this patch adds
a new deferred_warnings parameter to the function, letting the caller
control exactly how the warnings are emitted.
Diffstat (limited to 'gdb/dwarf2/aranges.c')
-rw-r--r-- | gdb/dwarf2/aranges.c | 77 |
1 files changed, 40 insertions, 37 deletions
diff --git a/gdb/dwarf2/aranges.c b/gdb/dwarf2/aranges.c index 06f49a4..b7d050b 100644 --- a/gdb/dwarf2/aranges.c +++ b/gdb/dwarf2/aranges.c @@ -26,7 +26,8 @@ bool read_addrmap_from_aranges (dwarf2_per_objfile *per_objfile, dwarf2_section_info *section, - addrmap *mutable_map) + addrmap *mutable_map, + deferred_warnings *warn) { /* Caller must ensure that the section has already been read. */ gdb_assert (section->readin); @@ -76,13 +77,13 @@ read_addrmap_from_aranges (dwarf2_per_objfile *per_objfile, const uint8_t offset_size = dwarf5_is_dwarf64 ? 8 : 4; if (addr + entry_length > section->buffer + section->size) { - warning (_("Section .debug_aranges in %s entry at offset %s " - "length %s exceeds section length %s, " - "ignoring .debug_aranges."), - objfile_name (objfile), - plongest (entry_addr - section->buffer), - plongest (bytes_read + entry_length), - pulongest (section->size)); + warn->warn (_("Section .debug_aranges in %s entry at offset %s " + "length %s exceeds section length %s, " + "ignoring .debug_aranges."), + objfile_name (objfile), + plongest (entry_addr - section->buffer), + plongest (bytes_read + entry_length), + pulongest (section->size)); return false; } @@ -91,10 +92,11 @@ read_addrmap_from_aranges (dwarf2_per_objfile *per_objfile, addr += 2; if (version != 2) { - warning (_("Section .debug_aranges in %s entry at offset %s " - "has unsupported version %d, ignoring .debug_aranges."), - objfile_name (objfile), - plongest (entry_addr - section->buffer), version); + warn->warn + (_("Section .debug_aranges in %s entry at offset %s " + "has unsupported version %d, ignoring .debug_aranges."), + objfile_name (objfile), + plongest (entry_addr - section->buffer), version); return false; } @@ -105,22 +107,22 @@ read_addrmap_from_aranges (dwarf2_per_objfile *per_objfile, = debug_info_offset_to_per_cu.find (sect_offset (debug_info_offset)); if (per_cu_it == debug_info_offset_to_per_cu.cend ()) { - warning (_("Section .debug_aranges in %s entry at offset %s " - "debug_info_offset %s does not exists, " - "ignoring .debug_aranges."), - objfile_name (objfile), - plongest (entry_addr - section->buffer), - pulongest (debug_info_offset)); + warn->warn (_("Section .debug_aranges in %s entry at offset %s " + "debug_info_offset %s does not exists, " + "ignoring .debug_aranges."), + objfile_name (objfile), + plongest (entry_addr - section->buffer), + pulongest (debug_info_offset)); return false; } const auto insertpair = debug_info_offset_seen.insert (sect_offset (debug_info_offset)); if (!insertpair.second) { - warning (_("Section .debug_aranges in %s has duplicate " - "debug_info_offset %s, ignoring .debug_aranges."), - objfile_name (objfile), - sect_offset_str (sect_offset (debug_info_offset))); + warn->warn (_("Section .debug_aranges in %s has duplicate " + "debug_info_offset %s, ignoring .debug_aranges."), + objfile_name (objfile), + sect_offset_str (sect_offset (debug_info_offset))); return false; } dwarf2_per_cu_data *const per_cu = per_cu_it->second; @@ -128,22 +130,23 @@ read_addrmap_from_aranges (dwarf2_per_objfile *per_objfile, const uint8_t address_size = *addr++; if (address_size < 1 || address_size > 8) { - warning (_("Section .debug_aranges in %s entry at offset %s " - "address_size %u is invalid, ignoring .debug_aranges."), - objfile_name (objfile), - plongest (entry_addr - section->buffer), address_size); + warn->warn + (_("Section .debug_aranges in %s entry at offset %s " + "address_size %u is invalid, ignoring .debug_aranges."), + objfile_name (objfile), + plongest (entry_addr - section->buffer), address_size); return false; } const uint8_t segment_selector_size = *addr++; if (segment_selector_size != 0) { - warning (_("Section .debug_aranges in %s entry at offset %s " - "segment_selector_size %u is not supported, " - "ignoring .debug_aranges."), - objfile_name (objfile), - plongest (entry_addr - section->buffer), - segment_selector_size); + warn->warn (_("Section .debug_aranges in %s entry at offset %s " + "segment_selector_size %u is not supported, " + "ignoring .debug_aranges."), + objfile_name (objfile), + plongest (entry_addr - section->buffer), + segment_selector_size); return false; } @@ -160,11 +163,11 @@ read_addrmap_from_aranges (dwarf2_per_objfile *per_objfile, { if (addr + 2 * address_size > entry_end) { - warning (_("Section .debug_aranges in %s entry at offset %s " - "address list is not properly terminated, " - "ignoring .debug_aranges."), - objfile_name (objfile), - plongest (entry_addr - section->buffer)); + warn->warn (_("Section .debug_aranges in %s entry at offset %s " + "address list is not properly terminated, " + "ignoring .debug_aranges."), + objfile_name (objfile), + plongest (entry_addr - section->buffer)); return false; } ULONGEST start = extract_unsigned_integer (addr, address_size, |