Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Stack Cursor] add back link register, do stack walk based on linked register when pc is null #356

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 12 additions & 5 deletions Source/KSCrash/Recording/Tools/KSStackCursor_MachineContext.c
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)
kstenerud marked this conversation as resolved.
Show resolved Hide resolved
{
nextAddress = context->linkRegister;
goto successfulExit;
}
}

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