From 6c43e376edc10d4d4d2fcd5fecf133b47ad63be6 Mon Sep 17 00:00:00 2001 From: Jeremy <51220084+jeremy-rifkin@users.noreply.github.com> Date: Tue, 28 May 2024 19:19:02 -0500 Subject: [PATCH] A couple lingering cleanups / fixes --- README.md | 7 ++----- src/symbols/dwarf/dwarf_resolver.cpp | 22 ++++------------------ 2 files changed, 6 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 2051189..a3b5c2c 100644 --- a/README.md +++ b/README.md @@ -576,15 +576,12 @@ namespace cpptrace { | --------------------------------- | --------- | | DWARF in binary | ✔️ | | GNU debug link | ️️✔️ | -| Split dwarf with dwarf 5 | ✔️* | -| Split dwarf with extended dwarf 4 | ❌** | +| Split dwarf (debug fission) | ✔️* | | DWARF in dSYM | ✔️ | | DWARF via Mach-O debug map | ✔️ | | Windows debug symbols in PDB | ✔️ | -*There seem to be a couple issues upstream with libdwarf however they will hopefully be resolved soon - -**Waiting on support from upstream libdwarf +*There seem to be a couple issues upstream with libdwarf however they will hopefully be resolved soon. DWARF5 added DWARF package files. As far as I can tell no compiler implements these yet. diff --git a/src/symbols/dwarf/dwarf_resolver.cpp b/src/symbols/dwarf/dwarf_resolver.cpp index 85746df..7a9c8bc 100644 --- a/src/symbols/dwarf/dwarf_resolver.cpp +++ b/src/symbols/dwarf/dwarf_resolver.cpp @@ -68,8 +68,6 @@ namespace libdwarf { std::vector line_entries; }; - using addr_table = std::vector; - class dwarf_resolver; // used to describe data from an upstream binary to a resolver for the .dwo @@ -330,6 +328,7 @@ namespace libdwarf { // despite (some) dwarf using 1-indexing, file_i should be the 0-based index std::string resolve_filename(const die_object& cu_die, Dwarf_Unsigned file_i) { + // for split-dwarf line resolution happens in the skeleton if(skeleton) { return skeleton.unwrap().resolver.resolve_filename(skeleton.unwrap().cu_die, file_i); } @@ -908,6 +907,7 @@ namespace libdwarf { return pc < entry.low; } ); + // TODO: Vec-it is already range-based, this range check is redundant // If the vector has been empty this can happen if(vec_it != cu_cache.end()) { // TODO: Cache the range list? @@ -945,24 +945,10 @@ namespace libdwarf { std::vector& inlines ) { // Split dwarf / debug fission / dwo is handled here + // Location of the split full CU is a combination of DW_AT_dwo_name/DW_AT_GNU_dwo_name and DW_AT_comp_dir // https://gcc.gnu.org/wiki/DebugFission - // Some oddities: - // - The .debug_line table remains in the main object - // - Due to relocations the dwo file won't have object addresses and instead DW_AT_low_pc will be of - // type DW_FORM_addr_index referencing the .debug_addr table stored in the main object - // - These index is relative to the DW_AT_addr_base - // DW_AT_dwo_name/DW_AT_GNU_dwo_name - // DW_AT_comp_dir - // DW_AT_addr_base/DW_AT_GNU_addr_base - // DW_AT_GNU_dwo_id/...? - // DW_TAG_skeleton_unit vs ... - // TODO: Handle gnu dwarf4 extensions for this - // TODO: DWO ID - // TODO: What is dwp???? - // TODO: dwarf_cu_header_basics passes out an is_dwo flag - // TODO: dwarf_get_xu_index_header??? - // Symbol loading is done in the dwo, line loading is deferred back to the skeleton if(dwo_name) { + // TODO: DWO ID? auto comp_dir = cu_die.get_string_attribute(DW_AT_comp_dir); Dwarf_Half offset_size = 0; Dwarf_Half dwversion = 0;