diff --git a/matrix/matrix-iOS/Matrix/WCCrashBlockMonitor/KSCrash/Recording/Tools/KSStackCursor_MachineContext.c b/matrix/matrix-iOS/Matrix/WCCrashBlockMonitor/KSCrash/Recording/Tools/KSStackCursor_MachineContext.c index 174455b52..a32e9693a 100644 --- a/matrix/matrix-iOS/Matrix/WCCrashBlockMonitor/KSCrash/Recording/Tools/KSStackCursor_MachineContext.c +++ b/matrix/matrix-iOS/Matrix/WCCrashBlockMonitor/KSCrash/Recording/Tools/KSStackCursor_MachineContext.c @@ -114,8 +114,9 @@ static bool advanceCursor(KSStackCursor *cursor) return false; } - if(context->instructionAddress == 0) + if(context->instructionAddress == 0 && cursor->state.currentDepth == 0) { + // Link register, if available, is the second address in the trace. context->instructionAddress = kscpu_instructionAddress(context->machineContext); if(context->instructionAddress == 0) { @@ -124,6 +125,16 @@ static bool advanceCursor(KSStackCursor *cursor) nextAddress = context->instructionAddress; goto successfulExit; } + + if (context->linkRegister == 0 && !context->isPastFramePointer) + { + context->linkRegister = kscpu_linkRegister(context->machineContext); + if (context->linkRegister != 0) + { + nextAddress = context->linkRegister; + goto successfulExit; + } + } if(context->currentFrame.previous == NULL) {