summaryrefslogtreecommitdiffstats
path: root/src/core/hle
diff options
context:
space:
mode:
authorDavid Marcec <dmarcecguzman@gmail.com>2018-12-03 09:12:09 +0100
committerDavid Marcec <dmarcecguzman@gmail.com>2018-12-03 09:12:09 +0100
commit71493327121038696c887158cb34f94e2f225e0f (patch)
tree6293ecbf4174fb8fa48238a48b02736585f31592 /src/core/hle
parentMerge pull request #1827 from ReinUsesLisp/clip-and-shader (diff)
downloadyuzu-71493327121038696c887158cb34f94e2f225e0f.tar
yuzu-71493327121038696c887158cb34f94e2f225e0f.tar.gz
yuzu-71493327121038696c887158cb34f94e2f225e0f.tar.bz2
yuzu-71493327121038696c887158cb34f94e2f225e0f.tar.lz
yuzu-71493327121038696c887158cb34f94e2f225e0f.tar.xz
yuzu-71493327121038696c887158cb34f94e2f225e0f.tar.zst
yuzu-71493327121038696c887158cb34f94e2f225e0f.zip
Diffstat (limited to 'src/core/hle')
-rw-r--r--src/core/hle/kernel/svc.cpp2
-rw-r--r--src/core/hle/kernel/thread.cpp17
-rw-r--r--src/core/hle/kernel/thread.h5
3 files changed, 24 insertions, 0 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index 3339777c1..2273f0bcf 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -625,6 +625,8 @@ static void Break(u32 reason, u64 info1, u64 info2) {
"Emulated program broke execution! reason=0x{:016X}, info1=0x{:016X}, info2=0x{:016X}",
reason, info1, info2);
handle_debug_buffer(info1, info2);
+ GetCurrentThread()->LogBacktrace();
+
ASSERT(false);
Core::CurrentProcess()->PrepareForTermination();
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp
index 4ffb76818..a044db6e7 100644
--- a/src/core/hle/kernel/thread.cpp
+++ b/src/core/hle/kernel/thread.cpp
@@ -388,6 +388,23 @@ bool Thread::InvokeWakeupCallback(ThreadWakeupReason reason, SharedPtr<Thread> t
return wakeup_callback(reason, std::move(thread), std::move(object), index);
}
+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);
+ }
+}
+
////////////////////////////////////////////////////////////////////////////////////////////////////
/**
diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h
index d384d50db..469f8a56d 100644
--- a/src/core/hle/kernel/thread.h
+++ b/src/core/hle/kernel/thread.h
@@ -240,6 +240,11 @@ public:
return status == ThreadStatus::WaitSynchAll;
}
+ /**
+ * Logs the backtrace for the current thread
+ */
+ void LogBacktrace();
+
ThreadContext& GetContext() {
return context;
}