From 6c7f4b63f5d83570f44b447f690420a5d75f02de Mon Sep 17 00:00:00 2001 From: dbalatoni13 <40299962+dbalatoni13@users.noreply.github.com> Date: Fri, 3 Jul 2026 03:00:18 +0200 Subject: [PATCH] Dwarf: Attempt at handling when the first function param is the stack return value --- src/util/dwarf/mod.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/util/dwarf/mod.rs b/src/util/dwarf/mod.rs index e8d459df..19080e29 100644 --- a/src/util/dwarf/mod.rs +++ b/src/util/dwarf/mod.rs @@ -1966,6 +1966,21 @@ fn process_subroutine_tag(info: &DwarfInfo, tag: &Tag) -> Result } } + if this_pointer_found + && let Some(param) = parameters.first() + && let Some(name) = ¶m.name + && name != "this" + { + // MWCC can turn stack returned local variables into the first parameter + let stack_param = parameters.remove(0); + variables.push(SubroutineVariable { + name: stack_param.name, + mangled_name: None, + kind: stack_param.kind, + location: stack_param.location, + }); + } + let return_type = return_type .unwrap_or_else(|| Type { kind: TypeKind::Fundamental(FundType::Void), modifiers: vec![] }); let direct_member_of = direct_base_key;