summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Marcec <dmarcecguzman@gmail.com>2018-12-03 10:13:48 +0100
committerDavid Marcec <dmarcecguzman@gmail.com>2018-12-03 10:13:48 +0100
commit5102c912569a29259ec26aa254d4598e81205a17 (patch)
treed7437b2cf2fd53771735a2938174a4aaaed03e4e
parentPrint backtrace on svcBreak (diff)
downloadyuzu-5102c912569a29259ec26aa254d4598e81205a17.tar
yuzu-5102c912569a29259ec26aa254d4598e81205a17.tar.gz
yuzu-5102c912569a29259ec26aa254d4598e81205a17.tar.bz2
yuzu-5102c912569a29259ec26aa254d4598e81205a17.tar.lz
yuzu-5102c912569a29259ec26aa254d4598e81205a17.tar.xz
yuzu-5102c912569a29259ec26aa254d4598e81205a17.tar.zst
yuzu-5102c912569a29259ec26aa254d4598e81205a17.zip
-rw-r--r--src/core/arm/arm_interface.h2
-rw-r--r--src/core/arm/dynarmic/arm_dynarmic.cpp16
-rw-r--r--src/core/arm/dynarmic/arm_dynarmic.h2
-rw-r--r--src/core/arm/unicorn/arm_unicorn.cpp17
-rw-r--r--src/core/arm/unicorn/arm_unicorn.h1
-rw-r--r--src/core/hle/kernel/thread.cpp15
6 files changed, 39 insertions, 14 deletions
diff --git a/src/core/arm/arm_interface.h b/src/core/arm/arm_interface.h
index 59da33f30..26fe68a2e 100644
--- a/src/core/arm/arm_interface.h
+++ b/src/core/arm/arm_interface.h
@@ -141,6 +141,8 @@ public:
/// Prepare core for thread reschedule (if needed to correctly handle state)
virtual void PrepareReschedule() = 0;
+
+ virtual void LogBacktrace() = 0;
};
} // namespace Core
diff --git a/src/core/arm/dynarmic/arm_dynarmic.cpp b/src/core/arm/dynarmic/arm_dynarmic.cpp
index 4d2491870..47dadba91 100644
--- a/src/core/arm/dynarmic/arm_dynarmic.cpp
+++ b/src/core/arm/dynarmic/arm_dynarmic.cpp
@@ -278,6 +278,22 @@ void ARM_Dynarmic::PageTableChanged() {
current_page_table = Memory::GetCurrentPageTable();
}
+void ARM_Dynarmic::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);
+ }
+}
+
DynarmicExclusiveMonitor::DynarmicExclusiveMonitor(std::size_t core_count) : monitor(core_count) {}
DynarmicExclusiveMonitor::~DynarmicExclusiveMonitor() = default;
diff --git a/src/core/arm/dynarmic/arm_dynarmic.h b/src/core/arm/dynarmic/arm_dynarmic.h
index 512bf8ce9..791653233 100644
--- a/src/core/arm/dynarmic/arm_dynarmic.h
+++ b/src/core/arm/dynarmic/arm_dynarmic.h
@@ -53,6 +53,8 @@ public:
void ClearInstructionCache() override;
void PageTableChanged() override;
+ void LogBacktrace() override;
+
private:
std::unique_ptr<Dynarmic::A64::Jit> MakeJit() const;
diff --git a/src/core/arm/unicorn/arm_unicorn.cpp b/src/core/arm/unicorn/arm_unicorn.cpp
index ded4dd359..c9495124e 100644
--- a/src/core/arm/unicorn/arm_unicorn.cpp
+++ b/src/core/arm/unicorn/arm_unicorn.cpp
@@ -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 {
@@ -266,6 +267,22 @@ void ARM_Unicorn::ClearExclusiveState() {}
void ARM_Unicorn::ClearInstructionCache() {}
+void ARM_Unicorn::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);
+ }
+}
+
void ARM_Unicorn::RecordBreak(GDBStub::BreakpointAddress bkpt) {
last_bkpt = bkpt;
last_bkpt_hit = true;
diff --git a/src/core/arm/unicorn/arm_unicorn.h b/src/core/arm/unicorn/arm_unicorn.h
index 75761950b..41da6a73c 100644
--- a/src/core/arm/unicorn/arm_unicorn.h
+++ b/src/core/arm/unicorn/arm_unicorn.h
@@ -40,6 +40,7 @@ public:
void ClearInstructionCache() override;
void PageTableChanged() override{};
void RecordBreak(GDBStub::BreakpointAddress bkpt);
+ void LogBacktrace() override;
private:
uc_engine* uc{};
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp
index a044db6e7..a276812f0 100644
--- a/src/core/hle/kernel/thread.cpp
+++ b/src/core/hle/kernel/thread.cpp
@@ -389,20 +389,7 @@ bool Thread::InvokeWakeupCallback(ThreadWakeupReason reason, SharedPtr<Thread> t
}
void Thread::LogBacktrace() {
- auto& system = Core::System::GetInstance();
- VAddr fp = system.ArmInterface(processor_id).GetReg(29);
- VAddr lr = system.ArmInterface(processor_id).GetReg(30);
- VAddr sp = system.ArmInterface(processor_id).GetReg(13);
- VAddr pc = system.ArmInterface(processor_id).GetPC();
- LOG_ERROR(Debug, "Backtrace, sp={:016X}, pc={:016X}", sp, pc);
- for (std::size_t i = 0; i < 256; i++) {
- LOG_ERROR(Debug, "{:016X}", lr - 4);
- if (!fp) {
- break;
- }
- lr = Memory::Read64(fp + 8);
- fp = Memory::Read64(fp);
- }
+ Core::System::GetInstance().ArmInterface(processor_id).LogBacktrace();
}
////////////////////////////////////////////////////////////////////////////////////////////////////