summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorJosh Ferrell <josh@vector35.com>2025-10-16 23:24:55 -0400
committerJosh Ferrell <josh@vector35.com>2025-10-16 23:24:55 -0400
commit50b1456506083140ded7e7c00bf5025547e99e70 (patch)
treed252a71d897a7ce05b330a6575acd52fc7747c79 /plugins
parentb6740d03abd22441e2e79e1d6a13c474e3fcba90 (diff)
Fix recovery of unnamed function parameters from DWARF
Diffstat (limited to 'plugins')
-rw-r--r--plugins/dwarf/dwarf_import/src/die_handlers.rs55
1 files changed, 31 insertions, 24 deletions
diff --git a/plugins/dwarf/dwarf_import/src/die_handlers.rs b/plugins/dwarf/dwarf_import/src/die_handlers.rs
index da9f1b7d..dbc1491a 100644
--- a/plugins/dwarf/dwarf_import/src/die_handlers.rs
+++ b/plugins/dwarf/dwarf_import/src/die_handlers.rs
@@ -360,30 +360,37 @@ pub(crate) fn handle_function<R: ReaderType>(
let mut children = tree_root.children();
while let Ok(Some(child)) = children.next() {
if child.entry().tag() == constants::DW_TAG_formal_parameter {
- if let (Some(child_uid), Some(name)) = {
- (
- get_type(
- dwarf,
- unit,
- child.entry(),
- debug_info_builder_context,
- debug_info_builder,
- ),
- debug_info_builder_context.get_name(dwarf, unit, child.entry()),
- )
- } {
- let child_type = debug_info_builder
- .get_type(child_uid)
- .or_else(|| {
- log::error!(
- "Failed to get function parameter type with uid {}",
- child_uid
- );
- None
- })?
- .get_type();
- parameters.push(FunctionParameter::new(child_type, name, None));
- }
+ let Some(child_uid) = get_type(
+ dwarf,
+ unit,
+ child.entry(),
+ debug_info_builder_context,
+ debug_info_builder,
+ ) else {
+ log::error!(
+ "Failed to get function parameter child type in unit {:?} at offset {:x}",
+ unit.header.offset(),
+ child.entry().offset().0,
+ );
+ continue;
+ };
+ let name = debug_info_builder_context.get_name(dwarf, unit, child.entry());
+
+ let child_type = debug_info_builder
+ .get_type(child_uid)
+ .or_else(|| {
+ log::error!(
+ "Failed to get function parameter type with uid {}",
+ child_uid
+ );
+ None
+ })?
+ .get_type();
+ parameters.push(FunctionParameter::new(
+ child_type,
+ name.unwrap_or_default(),
+ None,
+ ));
} else if child.entry().tag() == constants::DW_TAG_unspecified_parameters {
variable_arguments = true;
}