From 6dbd3ed18ca5c5fc49fa897083d156da8131d6bd Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Sun, 21 Jul 2013 19:03:37 -0400 Subject: [PATCH] Debugger: Fix X86 handling of larger return values. For return values too large to fit into EAX:EDX, the address at which the value is located is stored in EAX. We were incorrectly assuming they were at the current stack pointer, which isn't necessarily the case depending on what optimization/code generation options were used, leading to us sometimes showing the wrong values for such case. The same issue showed up with debug binaries generated by Clang. --- src/apps/debugger/arch/x86/ArchitectureX86.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/apps/debugger/arch/x86/ArchitectureX86.cpp b/src/apps/debugger/arch/x86/ArchitectureX86.cpp index 39e5c7f71b..7fa5002e70 100644 --- a/src/apps/debugger/arch/x86/ArchitectureX86.cpp +++ b/src/apps/debugger/arch/x86/ArchitectureX86.cpp @@ -650,7 +650,8 @@ ArchitectureX86::GetReturnAddressLocation(StackFrame* frame, return B_NO_MEMORY; } else { ValuePieceLocation piece; - piece.SetToMemory(frame->GetCpuState()->StackPointer()); + CpuStateX86* state = dynamic_cast(frame->GetCpuState()); + piece.SetToMemory(state->IntRegisterValue(X86_REGISTER_EAX)); piece.SetSize(valueSize); if (!location->AddPiece(piece)) return B_NO_MEMORY;