summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar David2018-11-08 15:43:54 +1100
committerGravatar bunnei2018-11-07 20:43:54 -0800
commit581406af187980dd5aa7e1ae282319473cf0feb5 (patch)
treea66bbdfae4068ee28abd3a52f072757149a3aa35 /src
parentMerge pull request #1655 from ogniK5377/shantae (diff)
downloadyuzu-581406af187980dd5aa7e1ae282319473cf0feb5.tar.gz
yuzu-581406af187980dd5aa7e1ae282319473cf0feb5.tar.xz
yuzu-581406af187980dd5aa7e1ae282319473cf0feb5.zip
svcBreak now dumps information from the debug buffer passed (#1646)
* svcBreak now dumps information from the debug buffer passed info1 and info2 seem to somtimes hold an address to a buffer, this is usually 4 bytes or the size of the int and contains an error code. There's other circumstances where it can be something different so we hexdump these to examine them at a later date. * Addressed comments
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 {
395/// Break program execution 395/// Break program execution
396static void Break(u32 reason, u64 info1, u64 info2) { 396static void Break(u32 reason, u64 info1, u64 info2) {
397 BreakReason break_reason{reason}; 397 BreakReason break_reason{reason};
398 bool has_dumped_buffer{};
398 399
400 const auto handle_debug_buffer = [&](VAddr addr, u64 sz) {
401 if (sz == 0 || addr == 0 || has_dumped_buffer) {
402 return;
403 }
404
405 // This typically is an error code so we're going to assume this is the case
406 if (sz == sizeof(u32)) {
407 LOG_CRITICAL(Debug_Emulated, "debug_buffer_err_code={:X}", Memory::Read32(addr));
408 } else {
409 // We don't know what's in here so we'll hexdump it
410 std::vector<u8> debug_buffer(sz);
411 Memory::ReadBlock(addr, debug_buffer.data(), sz);
412 std::string hexdump;
413 for (std::size_t i = 0; i < debug_buffer.size(); i++) {
414 hexdump += fmt::format("{:02X} ", debug_buffer[i]);
415 if (i != 0 && i % 16 == 0) {
416 hexdump += '\n';
417 }
418 }
419 LOG_CRITICAL(Debug_Emulated, "debug_buffer=\n{}", hexdump);
420 }
421 has_dumped_buffer = true;
422 };
399 switch (break_reason.break_type) { 423 switch (break_reason.break_type) {
400 case BreakType::Panic: 424 case BreakType::Panic:
401 LOG_CRITICAL(Debug_Emulated, "Signalling debugger, PANIC! info1=0x{:016X}, info2=0x{:016X}", 425 LOG_CRITICAL(Debug_Emulated, "Signalling debugger, PANIC! info1=0x{:016X}, info2=0x{:016X}",
402 info1, info2); 426 info1, info2);
427 handle_debug_buffer(info1, info2);
403 break; 428 break;
404 case BreakType::AssertionFailed: 429 case BreakType::AssertionFailed:
405 LOG_CRITICAL(Debug_Emulated, 430 LOG_CRITICAL(Debug_Emulated,
406 "Signalling debugger, Assertion failed! info1=0x{:016X}, info2=0x{:016X}", 431 "Signalling debugger, Assertion failed! info1=0x{:016X}, info2=0x{:016X}",
407 info1, info2); 432 info1, info2);
433 handle_debug_buffer(info1, info2);
408 break; 434 break;
409 case BreakType::PreNROLoad: 435 case BreakType::PreNROLoad:
410 LOG_WARNING( 436 LOG_WARNING(
@@ -433,6 +459,7 @@ static void Break(u32 reason, u64 info1, u64 info2) {
433 Debug_Emulated, 459 Debug_Emulated,
434 "Signalling debugger, Unknown break reason {}, info1=0x{:016X}, info2=0x{:016X}", 460 "Signalling debugger, Unknown break reason {}, info1=0x{:016X}, info2=0x{:016X}",
435 static_cast<u32>(break_reason.break_type.Value()), info1, info2); 461 static_cast<u32>(break_reason.break_type.Value()), info1, info2);
462 handle_debug_buffer(info1, info2);
436 break; 463 break;
437 } 464 }
438 465
@@ -441,6 +468,7 @@ static void Break(u32 reason, u64 info1, u64 info2) {
441 Debug_Emulated, 468 Debug_Emulated,
442 "Emulated program broke execution! reason=0x{:016X}, info1=0x{:016X}, info2=0x{:016X}", 469 "Emulated program broke execution! reason=0x{:016X}, info1=0x{:016X}, info2=0x{:016X}",
443 reason, info1, info2); 470 reason, info1, info2);
471 handle_debug_buffer(info1, info2);
444 ASSERT(false); 472 ASSERT(false);
445 473
446 Core::CurrentProcess()->PrepareForTermination(); 474 Core::CurrentProcess()->PrepareForTermination();