summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel
diff options
context:
space:
mode:
authorGravatar David Marcec2018-12-03 19:12:09 +1100
committerGravatar David Marcec2018-12-03 19:12:09 +1100
commit71493327121038696c887158cb34f94e2f225e0f (patch)
tree6293ecbf4174fb8fa48238a48b02736585f31592 /src/core/hle/kernel
parentMerge pull request #1827 from ReinUsesLisp/clip-and-shader (diff)
downloadyuzu-71493327121038696c887158cb34f94e2f225e0f.tar.gz
yuzu-71493327121038696c887158cb34f94e2f225e0f.tar.xz
yuzu-71493327121038696c887158cb34f94e2f225e0f.zip
Print backtrace on svcBreak
When we get an svcBreak we get a backtrace now
Diffstat (limited to 'src/core/hle/kernel')
-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) {
625 "Emulated program broke execution! reason=0x{:016X}, info1=0x{:016X}, info2=0x{:016X}", 625 "Emulated program broke execution! reason=0x{:016X}, info1=0x{:016X}, info2=0x{:016X}",
626 reason, info1, info2); 626 reason, info1, info2);
627 handle_debug_buffer(info1, info2); 627 handle_debug_buffer(info1, info2);
628 GetCurrentThread()->LogBacktrace();
629
628 ASSERT(false); 630 ASSERT(false);
629 631
630 Core::CurrentProcess()->PrepareForTermination(); 632 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
388 return wakeup_callback(reason, std::move(thread), std::move(object), index); 388 return wakeup_callback(reason, std::move(thread), std::move(object), index);
389} 389}
390 390
391void Thread::LogBacktrace() {
392 auto& system = Core::System::GetInstance();
393 VAddr fp = system.ArmInterface(processor_id).GetReg(29);
394 VAddr lr = system.ArmInterface(processor_id).GetReg(30);
395 VAddr sp = system.ArmInterface(processor_id).GetReg(13);
396 VAddr pc = system.ArmInterface(processor_id).GetPC();
397 LOG_ERROR(Debug, "Backtrace, sp={:016X}, pc={:016X}", sp, pc);
398 for (std::size_t i = 0; i < 256; i++) {
399 LOG_ERROR(Debug, "{:016X}", lr - 4);
400 if (!fp) {
401 break;
402 }
403 lr = Memory::Read64(fp + 8);
404 fp = Memory::Read64(fp);
405 }
406}
407
391//////////////////////////////////////////////////////////////////////////////////////////////////// 408////////////////////////////////////////////////////////////////////////////////////////////////////
392 409
393/** 410/**
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:
240 return status == ThreadStatus::WaitSynchAll; 240 return status == ThreadStatus::WaitSynchAll;
241 } 241 }
242 242
243 /**
244 * Logs the backtrace for the current thread
245 */
246 void LogBacktrace();
247
243 ThreadContext& GetContext() { 248 ThreadContext& GetContext() {
244 return context; 249 return context;
245 } 250 }