summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar David Marcec2018-12-29 12:55:19 +1100
committerGravatar David Marcec2018-12-29 12:55:19 +1100
commit22d4e106642ac9d6a0dabc700c4dcd47be08ff41 (patch)
tree61eaf5a2b7c296828c58a92791f7094b34285428 /src
parentMoved backtrace to ArmInterface (diff)
downloadyuzu-22d4e106642ac9d6a0dabc700c4dcd47be08ff41.tar.gz
yuzu-22d4e106642ac9d6a0dabc700c4dcd47be08ff41.tar.xz
yuzu-22d4e106642ac9d6a0dabc700c4dcd47be08ff41.zip
Moved log backtrace to arm_interface.cpp. Added printing of error code to fatal
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.h24
-rw-r--r--src/core/hle/service/fatal/fatal.cpp3
4 files changed, 36 insertions, 18 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index e1f21a764..0a8f018a1 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 b0472d55d..91d2b0f81 100644
--- a/src/core/arm/arm_interface.h
+++ b/src/core/arm/arm_interface.h
@@ -6,8 +6,6 @@
6 6
7#include <array> 7#include <array>
8#include "common/common_types.h" 8#include "common/common_types.h"
9#include "common/logging/log.h"
10#include "core/memory.h"
11 9
12namespace Kernel { 10namespace Kernel {
13enum class VMAPermission : u8; 11enum class VMAPermission : u8;
@@ -144,21 +142,13 @@ public:
144 /// Prepare core for thread reschedule (if needed to correctly handle state) 142 /// Prepare core for thread reschedule (if needed to correctly handle state)
145 virtual void PrepareReschedule() = 0; 143 virtual void PrepareReschedule() = 0;
146 144
147 void LogBacktrace() { 145 /// fp (= r29) points to the last frame record.
148 VAddr fp = GetReg(29); 146 /// Note that this is the frame record for the *previous* frame, not the current one.
149 VAddr lr = GetReg(30); 147 /// Note we need to subtract 4 from our last read to get the proper address
150 VAddr sp = GetReg(13); 148 /// Frame records are two words long:
151 VAddr pc = GetPC(); 149 /// fp+0 : pointer to previous frame record
152 LOG_ERROR(Core_ARM, "Backtrace, sp={:016X}, pc={:016X}", sp, pc); 150 /// fp+8 : value of lr for frame
153 for (;;) { 151 void LogBacktrace();
154 LOG_ERROR(Core_ARM, "{:016X}", lr);
155 if (!fp) {
156 break;
157 }
158 lr = Memory::Read64(fp + 8) - 4;
159 fp = Memory::Read64(fp);
160 }
161 }
162}; 152};
163 153
164} // namespace Core 154} // namespace Core
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);