mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-06-02 18:08:44 +02:00
41b98c7daa
Skyline's `exception` class now stores a list of all stack frames during the invocation of the exception. These can later be parsed by the exception handler to generate a human-readable stack trace. To assist with more complete stack traces, `-fno-omit-frame-pointer` is now passed on debug builds which forces the inclusion of frames on function calls.
21 lines
640 B
C++
21 lines
640 B
C++
// SPDX-License-Identifier: MPL-2.0
|
|
// Copyright © 2022 Skyline Team and Contributors (https://github.com/skyline-emu/)
|
|
|
|
#include "signal.h"
|
|
#include "exception.h"
|
|
|
|
namespace skyline {
|
|
std::vector<void *> exception::GetStackFrames() {
|
|
std::vector<void*> frames;
|
|
signal::StackFrame *frame{};
|
|
asm("MOV %0, FP" : "=r"(frame));
|
|
if (frame)
|
|
frame = frame->next; // We want to skip the first frame as it's going to be the caller of this function
|
|
while (frame && frame->lr) {
|
|
frames.push_back(frame->lr);
|
|
frame = frame->next;
|
|
}
|
|
return frames;
|
|
}
|
|
}
|