Skip to content

Commit 50b1456

Browse files
committed
Fix recovery of unnamed function parameters from DWARF
1 parent b6740d0 commit 50b1456

File tree

1 file changed

+31
-24
lines changed

1 file changed

+31
-24
lines changed

plugins/dwarf/dwarf_import/src/die_handlers.rs

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -360,30 +360,37 @@ pub(crate) fn handle_function<R: ReaderType>(
360360
let mut children = tree_root.children();
361361
while let Ok(Some(child)) = children.next() {
362362
if child.entry().tag() == constants::DW_TAG_formal_parameter {
363-
if let (Some(child_uid), Some(name)) = {
364-
(
365-
get_type(
366-
dwarf,
367-
unit,
368-
child.entry(),
369-
debug_info_builder_context,
370-
debug_info_builder,
371-
),
372-
debug_info_builder_context.get_name(dwarf, unit, child.entry()),
373-
)
374-
} {
375-
let child_type = debug_info_builder
376-
.get_type(child_uid)
377-
.or_else(|| {
378-
log::error!(
379-
"Failed to get function parameter type with uid {}",
380-
child_uid
381-
);
382-
None
383-
})?
384-
.get_type();
385-
parameters.push(FunctionParameter::new(child_type, name, None));
386-
}
363+
let Some(child_uid) = get_type(
364+
dwarf,
365+
unit,
366+
child.entry(),
367+
debug_info_builder_context,
368+
debug_info_builder,
369+
) else {
370+
log::error!(
371+
"Failed to get function parameter child type in unit {:?} at offset {:x}",
372+
unit.header.offset(),
373+
child.entry().offset().0,
374+
);
375+
continue;
376+
};
377+
let name = debug_info_builder_context.get_name(dwarf, unit, child.entry());
378+
379+
let child_type = debug_info_builder
380+
.get_type(child_uid)
381+
.or_else(|| {
382+
log::error!(
383+
"Failed to get function parameter type with uid {}",
384+
child_uid
385+
);
386+
None
387+
})?
388+
.get_type();
389+
parameters.push(FunctionParameter::new(
390+
child_type,
391+
name.unwrap_or_default(),
392+
None,
393+
));
387394
} else if child.entry().tag() == constants::DW_TAG_unspecified_parameters {
388395
variable_arguments = true;
389396
}

0 commit comments

Comments
 (0)