Merge pull request #1847 from ogniK5377/backtrace-break

Print backtrace on svcBreak
This commit is contained in:
bunnei 2018-12-29 22:58:13 -05:00 committed by GitHub
commit 331c252509
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 41 additions and 1 deletions

View file

@ -0,0 +1,26 @@
// Copyright 2018 yuzu emulator team
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "arm_interface.h"
#include "common/common_types.h"
#include "common/logging/log.h"
#include "core/memory.h"
namespace Core {
void ARM_Interface::LogBacktrace() {
VAddr fp = GetReg(29);
VAddr lr = GetReg(30);
VAddr sp = GetReg(13);
VAddr pc = GetPC();
LOG_ERROR(Core_ARM, "Backtrace, sp={:016X}, pc={:016X}", sp, pc);
for (;;) {
LOG_ERROR(Core_ARM, "{:016X}", lr);
if (!fp) {
break;
}
lr = Memory::Read64(fp + 8) - 4;
fp = Memory::Read64(fp);
}
}
}; // namespace Core

View file

@ -141,6 +141,14 @@ public:
/// Prepare core for thread reschedule (if needed to correctly handle state)
virtual void PrepareReschedule() = 0;
/// fp (= r29) points to the last frame record.
/// Note that this is the frame record for the *previous* frame, not the current one.
/// Note we need to subtract 4 from our last read to get the proper address
/// Frame records are two words long:
/// fp+0 : pointer to previous frame record
/// fp+8 : value of lr for frame
void LogBacktrace();
};
} // namespace Core

View file

@ -10,6 +10,7 @@
#include "core/core.h"
#include "core/core_timing.h"
#include "core/hle/kernel/svc.h"
#include "core/memory.h"
namespace Core {