summaryrefslogtreecommitdiffstats
path: root/libdw/dwarf_end.c
diff options
context:
space:
mode:
authorPetr Machata <[email protected]>2014-10-17 02:47:03 +0200
committerPetr Machata <[email protected]>2014-11-10 15:45:00 +0100
commitfb90bf3f84b5683bbc1f234ee05008ff26250e5c (patch)
treeb29eb4c3b3ab559167fc8cacce36b99ef958c367 /libdw/dwarf_end.c
parentd8b9682b1a5ff2746f172487eaf19ebd088bb7f4 (diff)
Support .debug_macro
- This code is based on the following proposal: http://www.dwarfstd.org/ShowIssue.php?issue=110722.1 - dwarf_getmacros serves either of .debug_macinfo or .debug_macro transparently, but if the latter uses opcode 0xff, it bails out with an error. The reason is that in .debug_macro, 0xff is a custom code that can mean anything, while in .debug_macinfo there's fixed semantics associated with 0xff. - dwarf_getmacros_off is a new interface used for requesting iteration through transparently included units. - dwarf_macro_getparamcnt and dwarf_macro_param are new interfaces used for requesting number of parameters of an opcode and individual parameters. dwarf_macro_getsrcfiles is a new interface used for requesting a file part of .debug_line unit associated with macro unit that the opcode comes from. - The existing interfaces dwarf_macro_opcode, dwarf_macro_param1 and dwarf_macro_param2 remain operational for old- as well as new-style Dwarf macro sections, if applicable. - dwarf_getsrclines was made into a light wrapper around a worker function that loads line unit given its offset. The worker also caches loaded units in an offset-keyed search tree, so that we don't end up re-reading units even though they were read in a different domain (e.g. a macro unit request can prime cache for later CU lookup). dwarf_macro_getsrcfiles calls the worker function under covers. Signed-off-by: Petr Machata <[email protected]>
Diffstat (limited to 'libdw/dwarf_end.c')
-rw-r--r--libdw/dwarf_end.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libdw/dwarf_end.c b/libdw/dwarf_end.c
index 241a257a..647a1b8d 100644
--- a/libdw/dwarf_end.c
+++ b/libdw/dwarf_end.c
@@ -93,6 +93,12 @@ dwarf_end (dwarf)
tdestroy (dwarf->cu_tree, cu_free);
tdestroy (dwarf->tu_tree, cu_free);
+ /* Search tree for macro opcode tables. */
+ tdestroy (dwarf->macro_ops, noop_free);
+
+ /* Search tree for decoded .debug_lines units. */
+ tdestroy (dwarf->files_lines, noop_free);
+
struct libdw_memblock *memp = dwarf->mem_tail;
/* The first block is allocated together with the Dwarf object. */
while (memp->prev != NULL)