diff --git a/src/apps/debugger/arch/x86/ArchitectureX86.cpp b/src/apps/debugger/arch/x86/ArchitectureX86.cpp
index bc2e075..63a080f 100644
a
|
b
|
ArchitectureX86::CreateStackFrame(Image* image, FunctionDebugInfo* function,
|
309 | 309 | // If the function is not frameless and we're at the top frame we need |
310 | 310 | // to check whether the prologue has not been executed (completely) or |
311 | 311 | // we're already after the epilogue. |
312 | | if (hasPrologue && isTopFrame) { |
| 312 | if (isTopFrame) { |
313 | 313 | uint32 stack = 0; |
314 | | if (eip < function->Address() + 3) { |
315 | | // The prologue has not been executed yet, i.e. there's no |
316 | | // stack frame yet. Get the return address from the stack. |
317 | | stack = cpuState->IntRegisterValue(X86_REGISTER_ESP); |
318 | | if (eip > function->Address()) { |
319 | | // The "push %ebp" has already been executed. |
320 | | stack += 4; |
| 314 | if (hasPrologue) { |
| 315 | if (eip < function->Address() + 3) { |
| 316 | // The prologue has not been executed yet, i.e. there's no |
| 317 | // stack frame yet. Get the return address from the stack. |
| 318 | stack = cpuState->IntRegisterValue(X86_REGISTER_ESP); |
| 319 | if (eip > function->Address()) { |
| 320 | // The "push %ebp" has already been executed. |
| 321 | stack += 4; |
| 322 | } |
| 323 | } else { |
| 324 | // Not in the function prologue, but maybe after the |
| 325 | // epilogue. The epilogue is a single "pop %ebp", so we |
| 326 | // check whether the current instruction is already a |
| 327 | // "ret". |
| 328 | uint8 code[1]; |
| 329 | if (fTeamMemory->ReadMemory(eip, &code, 1) == 1 |
| 330 | && code[0] == 0xc3) { |
| 331 | stack = cpuState->IntRegisterValue(X86_REGISTER_ESP); |
| 332 | } |
321 | 333 | } |
322 | 334 | } else { |
323 | | // Not in the function prologue, but maybe after the epilogue. |
324 | | // The epilogue is a single "pop %ebp", so we check whether the |
325 | | // current instruction is already a "ret". |
326 | | uint8 code[1]; |
327 | | if (fTeamMemory->ReadMemory(eip, &code, 1) == 1 |
328 | | && code[0] == 0xc3) { |
| 335 | // in the case of a NULL function pointer, the prologue |
| 336 | // has, by definition not been executed. In such a case, |
| 337 | // everything we need is right at the top of the stack. |
| 338 | if (eip == 0) |
329 | 339 | stack = cpuState->IntRegisterValue(X86_REGISTER_ESP); |
330 | | } |
331 | 340 | } |
332 | 341 | |
333 | 342 | if (stack != 0) { |