diff options
| author | Josh Ferrell <josh@vector35.com> | 2025-04-18 15:46:27 -0400 |
|---|---|---|
| committer | Josh Ferrell <josh@vector35.com> | 2025-04-23 15:46:37 -0400 |
| commit | 0493db09dee436a9ecb9009ae7222dccefd3d5e3 (patch) | |
| tree | 7a775b5b383fcd77bb9ed3bab665a6b2d8a86408 /plugins/dwarf/dwarf_import/src/helpers.rs | |
| parent | 8385022779729901786510517878173596454097 (diff) | |
Various DWARF fixes
- Do not add binary base to function address twice when a symbol with that function's raw name already exists
- Load eh_frame/debug_frame from base bv instead of debug bv and make calculated cie offset ranges relative to bv start
- Fix dwarf raw name resolution not resolving specification
- Try to load eh_frame/debug_frame from both raw and normal views in dwarf import
Diffstat (limited to 'plugins/dwarf/dwarf_import/src/helpers.rs')
| -rw-r--r-- | plugins/dwarf/dwarf_import/src/helpers.rs | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/plugins/dwarf/dwarf_import/src/helpers.rs b/plugins/dwarf/dwarf_import/src/helpers.rs index e6f30a3b..e23eb498 100644 --- a/plugins/dwarf/dwarf_import/src/helpers.rs +++ b/plugins/dwarf/dwarf_import/src/helpers.rs @@ -221,21 +221,31 @@ pub(crate) fn get_raw_name<R: ReaderType>( dwarf: &Dwarf<R>, unit: &Unit<R>, entry: &DebuggingInformationEntry<R>, + debug_info_builder_context: &DebugInfoBuilderContext<R>, ) -> Option<String> { - if let Ok(Some(attr_val)) = entry.attr_value(constants::DW_AT_linkage_name) { - if let Ok(attr_string) = dwarf.attr_string(unit, attr_val.clone()) { - if let Ok(attr_string) = attr_string.to_string() { - return Some(attr_string.to_string()); - } - } else if let Some(dwarf) = dwarf.sup() { - if let Ok(attr_string) = dwarf.attr_string(unit, attr_val) { - if let Ok(attr_string) = attr_string.to_string() { - return Some(attr_string.to_string()); + match resolve_specification(dwarf, unit, entry, debug_info_builder_context) { + DieReference::UnitAndOffset((dwarf, entry_unit, entry_offset)) => { + if let Ok(Some(attr_val)) = entry_unit + .entry(entry_offset) + .unwrap() + .attr_value(constants::DW_AT_linkage_name) + { + if let Ok(attr_string) = dwarf.attr_string(entry_unit, attr_val.clone()) { + if let Ok(attr_string) = attr_string.to_string() { + return Some(attr_string.to_string()); + } + } else if let Some(dwarf) = &dwarf.sup { + if let Ok(attr_string) = dwarf.attr_string(entry_unit, attr_val) { + if let Ok(attr_string) = attr_string.to_string() { + return Some(attr_string.to_string()); + } + } } } + None } + DieReference::Err => None, } - None } // Get the size of an object as a usize |
