summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2018-12-29 22:58:13 -0500
committerGravatar GitHub2018-12-29 22:58:13 -0500
commit331c252509aa6c7712d983b388ba3533d3047df1 (patch)
treebdffbe558bab81adac706ed7ead2e6b91ed5a394 /src
parentMerge pull request #1964 from lioncash/time (diff)
parentMoved log backtrace to arm_interface.cpp. Added printing of error code to fatal (diff)
downloadyuzu-331c252509aa6c7712d983b388ba3533d3047df1.tar.gz
yuzu-331c252509aa6c7712d983b388ba3533d3047df1.tar.xz
yuzu-331c252509aa6c7712d983b388ba3533d3047df1.zip
Merge pull request #1847 from ogniK5377/backtrace-break
Print backtrace on svcBreak
Diffstat (limited to 'src')
-rw-r--r--src/core/CMakeLists.txt1
-rw-r--r--src/core/arm/arm_interface.cpp26
-rw-r--r--src/core/arm/arm_interface.h8
-rw-r--r--src/core/arm/unicorn/arm_unicorn.cpp1
-rw-r--r--src/core/hle/kernel/svc.cpp3
-rw-r--r--src/core/hle/service/fatal/fatal.cpp3
6 files changed, 41 insertions, 1 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index f38271336..8f2db5bea 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -1,5 +1,6 @@
1add_library(core STATIC 1add_library(core STATIC
2 arm/arm_interface.h 2 arm/arm_interface.h
3 arm/arm_interface.cpp
3 arm/exclusive_monitor.cpp 4 arm/exclusive_monitor.cpp
4 arm/exclusive_monitor.h 5 arm/exclusive_monitor.h
5 arm/unicorn/arm_unicorn.cpp 6 arm/unicorn/arm_unicorn.cpp
diff --git a/src/core/arm/arm_interface.cpp b/src/core/arm/arm_interface.cpp
new file mode 100644
index 000000000..bcc812da4
--- /dev/null
+++ b/src/core/arm/arm_interface.cpp
@@ -0,0 +1,26 @@
1// Copyright 2018 yuzu emulator team
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#include "arm_interface.h"
6#include "common/common_types.h"
7#include "common/logging/log.h"
8#include "core/memory.h"
9
10namespace Core {
11void ARM_Interface::LogBacktrace() {
12 VAddr fp = GetReg(29);
13 VAddr lr = GetReg(30);
14 VAddr sp = GetReg(13);
15 VAddr pc = GetPC();
16 LOG_ERROR(Core_ARM, "Backtrace, sp={:016X}, pc={:016X}", sp, pc);
17 for (;;) {
18 LOG_ERROR(Core_ARM, "{:016X}", lr);
19 if (!fp) {
20 break;
21 }
22 lr = Memory::Read64(fp + 8) - 4;
23 fp = Memory::Read64(fp);
24 }
25}
26}; // namespace Core
diff --git a/src/core/arm/arm_interface.h b/src/core/arm/arm_interface.h
index 59da33f30..91d2b0f81 100644
--- a/src/core/arm/arm_interface.h
+++ b/src/core/arm/arm_interface.h
@@ -141,6 +141,14 @@ public:
141 141
142 /// Prepare core for thread reschedule (if needed to correctly handle state) 142 /// Prepare core for thread reschedule (if needed to correctly handle state)
143 virtual void PrepareReschedule() = 0; 143 virtual void PrepareReschedule() = 0;
144
145 /// fp (= r29) points to the last frame record.
146 /// Note that this is the frame record for the *previous* frame, not the current one.
147 /// Note we need to subtract 4 from our last read to get the proper address
148 /// Frame records are two words long:
149 /// fp+0 : pointer to previous frame record
150 /// fp+8 : value of lr for frame
151 void LogBacktrace();
144}; 152};
145 153
146} // namespace Core 154} // namespace Core
diff --git a/src/core/arm/unicorn/arm_unicorn.cpp b/src/core/arm/unicorn/arm_unicorn.cpp
index ded4dd359..c455c81fb 100644
--- a/src/core/arm/unicorn/arm_unicorn.cpp
+++ b/src/core/arm/unicorn/arm_unicorn.cpp
@@ -10,6 +10,7 @@
10#include "core/core.h" 10#include "core/core.h"
11#include "core/core_timing.h" 11#include "core/core_timing.h"
12#include "core/hle/kernel/svc.h" 12#include "core/hle/kernel/svc.h"
13#include "core/memory.h"
13 14
14namespace Core { 15namespace Core {
15 16
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index b955f9839..5fac831ee 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -684,6 +684,9 @@ static void Break(u32 reason, u64 info1, u64 info2) {
684 "Emulated program broke execution! reason=0x{:016X}, info1=0x{:016X}, info2=0x{:016X}", 684 "Emulated program broke execution! reason=0x{:016X}, info1=0x{:016X}, info2=0x{:016X}",
685 reason, info1, info2); 685 reason, info1, info2);
686 handle_debug_buffer(info1, info2); 686 handle_debug_buffer(info1, info2);
687 Core::System::GetInstance()
688 .ArmInterface(static_cast<std::size_t>(GetCurrentThread()->GetProcessorID()))
689 .LogBacktrace();
687 ASSERT(false); 690 ASSERT(false);
688 691
689 Core::CurrentProcess()->PrepareForTermination(); 692 Core::CurrentProcess()->PrepareForTermination();
diff --git a/src/core/hle/service/fatal/fatal.cpp b/src/core/hle/service/fatal/fatal.cpp
index 2f15ac2a6..770590d0b 100644
--- a/src/core/hle/service/fatal/fatal.cpp
+++ b/src/core/hle/service/fatal/fatal.cpp
@@ -111,7 +111,8 @@ static void GenerateErrorReport(ResultCode error_code, const FatalInfo& info) {
111} 111}
112 112
113static void ThrowFatalError(ResultCode error_code, FatalType fatal_type, const FatalInfo& info) { 113static void ThrowFatalError(ResultCode error_code, FatalType fatal_type, const FatalInfo& info) {
114 LOG_ERROR(Service_Fatal, "Threw fatal error type {}", static_cast<u32>(fatal_type)); 114 LOG_ERROR(Service_Fatal, "Threw fatal error type {} with error code 0x{:X}",
115 static_cast<u32>(fatal_type), error_code.raw);
115 switch (fatal_type) { 116 switch (fatal_type) {
116 case FatalType::ErrorReportAndScreen: 117 case FatalType::ErrorReportAndScreen:
117 GenerateErrorReport(error_code, info); 118 GenerateErrorReport(error_code, info);