kern: implement thread call stack debug

This commit is contained in:
Michael Scire 2020-12-09 22:49:04 -08:00
parent 16e2f46aed
commit af259eabda
11 changed files with 657 additions and 32 deletions

View file

@ -21,16 +21,18 @@ namespace ams::kern::svc {
namespace {
[[maybe_unused]] void PrintBreak(ams::svc::BreakReason break_reason) {
#if defined(MESOSPHERE_BUILD_FOR_DEBUGGING)
void PrintBreak(ams::svc::BreakReason break_reason) {
/* Print that break was called. */
MESOSPHERE_RELEASE_LOG("%s: svc::Break(%d) was called, pid=%ld, tid=%ld\n", GetCurrentProcess().GetName(), static_cast<s32>(break_reason), GetCurrentProcess().GetId(), GetCurrentThread().GetId());
/* Print the current thread's registers. */
/* TODO: KDebug::PrintRegisters(); */
KDebug::PrintRegister();
/* Print a backtrace. */
/* TODO: KDebug::PrintBacktrace(); */
KDebug::PrintBacktrace();
}
#endif
void Break(ams::svc::BreakReason break_reason, uintptr_t address, size_t size) {
/* Determine whether the break is only a notification. */
@ -38,7 +40,7 @@ namespace ams::kern::svc {
/* If the break isn't a notification, print it. */
if (!is_notification) {
#ifdef MESOSPHERE_BUILD_FOR_DEBUGGING
#if defined(MESOSPHERE_BUILD_FOR_DEBUGGING)
PrintBreak(break_reason);
#endif
}