Skip to content

Commit

Permalink
Merge pull request #356 from mwenjiem/wenjie-do-stack-walk-based-on-l…
Browse files Browse the repository at this point in the history
…ink-register-when-pc-is-not-available

[Stack Cursor] add back link register, do stack walk based on linked register when pc is null
  • Loading branch information
kstenerud authored Nov 30, 2019
2 parents 0683491 + 88ab1b9 commit ce7c9e6
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions Source/KSCrash/Recording/Tools/KSStackCursor_MachineContext.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,23 @@ static bool advanceCursor(KSStackCursor *cursor)
return false;
}

if(context->instructionAddress == 0)
if(context->instructionAddress == 0 && cursor->state.currentDepth == 0)
{
context->instructionAddress = kscpu_instructionAddress(context->machineContext);
if(context->instructionAddress == 0)
{
return false;
}
nextAddress = context->instructionAddress;
goto successfulExit;
}

if(context->linkRegister == 0 && !context->isPastFramePointer)
{
// Link register, if available, is the second address in the trace.
context->linkRegister = kscpu_linkRegister(context->machineContext);
if(context->linkRegister != 0)
{
nextAddress = context->linkRegister;
goto successfulExit;
}
}

if(context->currentFrame.previous == NULL)
{
Expand Down

0 comments on commit ce7c9e6

Please sign in to comment.