mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-11-25 11:00:18 +00:00
kern: print kernel backtrace on panic
This commit is contained in:
parent
a89c5dd5d7
commit
8ef6c49d30
1 changed files with 12 additions and 5 deletions
|
@ -94,13 +94,16 @@ namespace ams::kern {
|
|||
/* Print the state. */
|
||||
MESOSPHERE_RELEASE_LOG("Core[%d] Current State:\n", core_id);
|
||||
|
||||
/* Print registers and user backtrace. */
|
||||
KDebug::PrintRegister();
|
||||
KDebug::PrintBacktrace();
|
||||
|
||||
/* Print kernel state. */
|
||||
#ifdef ATMOSPHERE_ARCH_ARM64
|
||||
MESOSPHERE_RELEASE_LOG("Kernel Registers:\n");
|
||||
for (size_t i = 0; i < 31; i++) {
|
||||
MESOSPHERE_RELEASE_LOG(" X[%02zu] = %016lx\n", i, core_ctx->x[i]);
|
||||
}
|
||||
MESOSPHERE_RELEASE_LOG(" SP = %016lx\n", core_ctx->sp);
|
||||
|
||||
/* Print kernel backtrace. */
|
||||
MESOSPHERE_RELEASE_LOG("Backtrace:\n");
|
||||
MESOSPHERE_RELEASE_LOG("Kernel Backtrace:\n");
|
||||
uintptr_t fp = core_ctx != nullptr ? core_ctx->x[29] : reinterpret_cast<uintptr_t>(__builtin_frame_address(0));
|
||||
for (size_t i = 0; i < 32 && fp && util::IsAligned(fp, 0x10) && cpu::GetPhysicalAddressWritable(nullptr, fp, true); i++) {
|
||||
struct {
|
||||
|
@ -112,6 +115,10 @@ namespace ams::kern {
|
|||
}
|
||||
#endif
|
||||
|
||||
/* Print registers and user backtrace. */
|
||||
KDebug::PrintRegister();
|
||||
KDebug::PrintBacktrace();
|
||||
|
||||
MESOSPHERE_RELEASE_LOG("\n");
|
||||
|
||||
/* Allow the next core to print. */
|
||||
|
|
Loading…
Reference in a new issue