summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/svc.cpp
diff options
context:
space:
mode:
authorDavid <25727384+ogniK5377@users.noreply.github.com>2018-11-08 05:43:54 +0100
committerbunnei <bunneidev@gmail.com>2018-11-08 05:43:54 +0100
commit581406af187980dd5aa7e1ae282319473cf0feb5 (patch)
treea66bbdfae4068ee28abd3a52f072757149a3aa35 /src/core/hle/kernel/svc.cpp
parentMerge pull request #1655 from ogniK5377/shantae (diff)
downloadyuzu-581406af187980dd5aa7e1ae282319473cf0feb5.tar
yuzu-581406af187980dd5aa7e1ae282319473cf0feb5.tar.gz
yuzu-581406af187980dd5aa7e1ae282319473cf0feb5.tar.bz2
yuzu-581406af187980dd5aa7e1ae282319473cf0feb5.tar.lz
yuzu-581406af187980dd5aa7e1ae282319473cf0feb5.tar.xz
yuzu-581406af187980dd5aa7e1ae282319473cf0feb5.tar.zst
yuzu-581406af187980dd5aa7e1ae282319473cf0feb5.zip
Diffstat (limited to '')
-rw-r--r--src/core/hle/kernel/svc.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index c7c579aaf..7e8e87c33 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -395,16 +395,42 @@ struct BreakReason {
/// Break program execution
static void Break(u32 reason, u64 info1, u64 info2) {
BreakReason break_reason{reason};
+ bool has_dumped_buffer{};
+ const auto handle_debug_buffer = [&](VAddr addr, u64 sz) {
+ if (sz == 0 || addr == 0 || has_dumped_buffer) {
+ return;
+ }
+
+ // This typically is an error code so we're going to assume this is the case
+ if (sz == sizeof(u32)) {
+ LOG_CRITICAL(Debug_Emulated, "debug_buffer_err_code={:X}", Memory::Read32(addr));
+ } else {
+ // We don't know what's in here so we'll hexdump it
+ std::vector<u8> debug_buffer(sz);
+ Memory::ReadBlock(addr, debug_buffer.data(), sz);
+ std::string hexdump;
+ for (std::size_t i = 0; i < debug_buffer.size(); i++) {
+ hexdump += fmt::format("{:02X} ", debug_buffer[i]);
+ if (i != 0 && i % 16 == 0) {
+ hexdump += '\n';
+ }
+ }
+ LOG_CRITICAL(Debug_Emulated, "debug_buffer=\n{}", hexdump);
+ }
+ has_dumped_buffer = true;
+ };
switch (break_reason.break_type) {
case BreakType::Panic:
LOG_CRITICAL(Debug_Emulated, "Signalling debugger, PANIC! info1=0x{:016X}, info2=0x{:016X}",
info1, info2);
+ handle_debug_buffer(info1, info2);
break;
case BreakType::AssertionFailed:
LOG_CRITICAL(Debug_Emulated,
"Signalling debugger, Assertion failed! info1=0x{:016X}, info2=0x{:016X}",
info1, info2);
+ handle_debug_buffer(info1, info2);
break;
case BreakType::PreNROLoad:
LOG_WARNING(
@@ -433,6 +459,7 @@ static void Break(u32 reason, u64 info1, u64 info2) {
Debug_Emulated,
"Signalling debugger, Unknown break reason {}, info1=0x{:016X}, info2=0x{:016X}",
static_cast<u32>(break_reason.break_type.Value()), info1, info2);
+ handle_debug_buffer(info1, info2);
break;
}
@@ -441,6 +468,7 @@ static void Break(u32 reason, u64 info1, u64 info2) {
Debug_Emulated,
"Emulated program broke execution! reason=0x{:016X}, info1=0x{:016X}, info2=0x{:016X}",
reason, info1, info2);
+ handle_debug_buffer(info1, info2);
ASSERT(false);
Core::CurrentProcess()->PrepareForTermination();