aboutsummaryrefslogtreecommitdiff
path: root/gdb/addrmap.h
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2024-09-28 08:35:02 +0200
committerTom de Vries <tdevries@suse.de>2024-09-28 08:35:02 +0200
commit18c4b05e40ebf5537f7171fadb2fdff86149faa3 (patch)
tree48c46f29096818fb211e6fdd9b8d48cc627352be /gdb/addrmap.h
parenteb5903a8e268ac4615f9f96a8254b0b72f585e07 (diff)
downloadgdb-18c4b05e40ebf5537f7171fadb2fdff86149faa3.zip
gdb-18c4b05e40ebf5537f7171fadb2fdff86149faa3.tar.gz
gdb-18c4b05e40ebf5537f7171fadb2fdff86149faa3.tar.bz2
[gdb/symtab] Dump m_all_parents_map for verbose debug dwarf-read
[ This is based on "[gdb/symtab] Add parent_map::dump" [1]. ] When building the cooked index, gdb builds up a parent map. This map is currently only visible at user level through the effect of using it, but it's useful to be able to inspect it as well. Add dumping of this parent map for "set debug dwarf-read 2". As example, take test-case gdb.dwarf2/enum-type-c++.exp with target board debug-types. The parent map looks like: ... $ gdb -q -batch \ -iex "maint set worker-threads 0" \ -iex "set debug dwarf-read 2" \ outputs/gdb.dwarf2/enum-type-c++/enum-type-c++ ... [dwarf-read] print_stats: Final m_all_parents_map: map start: 0x0000000000000000 0x0 0x0000000000000037 0x20f27d30 (0x36: ec) 0x0000000000000051 0x0 0x000000000000008b 0x20f27dc0 (0x8a: A) 0x00000000000000a6 0x0 ... There's no parent entry at address 0xd6, which is part of what causes this: ... (gdb) FAIL: gdb.dwarf2/enum-type-c++.exp: val1 has a parent ... With the series containing the proposed fix applied [2], we get instead: ... [dwarf-read] print_stats: Final m_all_parents_map: map start: 0x0000000000000000 0x0 0x0000000000000026 0x7e0bdc0 (0x25: ns) 0x0000000000000036 0x0 0x0000000000000037 0x7e0bdf0 (0x36: ns::ec) 0x0000000000000051 0x0 0x000000000000007f 0x7e0be80 (0x7e: ns) 0x000000000000008a 0x0 0x000000000000008b 0x7e0beb0 (0x8a: ns::A) 0x00000000000000a6 0x0 0x00000000000000cc 0x7e0bf10 (0xcb: ns) 0x00000000000000d4 0x7e0bf40 (0xd3: ns::A) 0x00000000000000dc 0x7e0bf10 (0xcb: ns) 0x00000000000000dd 0x7e0bf40 (0xd3: ns::A) 0x00000000000000f6 0x0 ... and find at 0xd6 parent ns::A. Tested on x86_64-linux. Approved-By: Tom Tromey <tom@tromey.com> [1] https://sourceware.org/pipermail/gdb-patches/2023-October/202883.html [2] https://sourceware.org/pipermail/gdb-patches/2024-September/211958.html
Diffstat (limited to 'gdb/addrmap.h')
-rw-r--r--gdb/addrmap.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/gdb/addrmap.h b/gdb/addrmap.h
index abd1ee3..85d4645 100644
--- a/gdb/addrmap.h
+++ b/gdb/addrmap.h
@@ -219,8 +219,13 @@ private:
/* Dump the addrmap to OUTFILE. If PAYLOAD is non-NULL, only dump any
components that map to PAYLOAD. (If PAYLOAD is NULL, the entire
- map is dumped.) */
+ map is dumped.) If ANNOTATE_VALUE is non-nullptr, call it for each
+ value. */
+
void addrmap_dump (struct addrmap *map, struct ui_file *outfile,
- void *payload);
+ void *payload,
+ gdb::function_view<void (struct ui_file *outfile,
+ const void *value)>
+ annotate_value = nullptr);
#endif /* ADDRMAP_H */