From 4c3297441c61b943ec1dc963a1ed002255def348 Mon Sep 17 00:00:00 2001 From: "Dr. Chat" Date: Sat, 6 Jun 2015 00:50:51 -0500 Subject: [PATCH] Log debugprint traps to the debugger, if attached --- src/xenia/cpu/backend/x64/x64_emitter.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/xenia/cpu/backend/x64/x64_emitter.cc b/src/xenia/cpu/backend/x64/x64_emitter.cc index 180ef188b..32b00c71f 100644 --- a/src/xenia/cpu/backend/x64/x64_emitter.cc +++ b/src/xenia/cpu/backend/x64/x64_emitter.cc @@ -13,6 +13,7 @@ #include "xenia/base/assert.h" #include "xenia/base/atomic.h" +#include "xenia/base/debugging.h" #include "xenia/base/logging.h" #include "xenia/base/math.h" #include "xenia/base/memory.h" @@ -34,6 +35,9 @@ DEFINE_bool( enable_haswell_instructions, true, "Uses the AVX2/FMA/etc instructions on Haswell processors, if available."); +DEFINE_bool(enable_debugprint_log, false, + "Log debugprint traps to the active debugger"); + namespace xe { namespace cpu { namespace backend { @@ -292,6 +296,11 @@ uint64_t TrapDebugPrint(void* raw_context, uint64_t address) { auto str = thread_state->memory()->TranslateVirtual(str_ptr); // TODO(benvanik): truncate to length? XELOGD("(DebugPrint) %s", str); + + if (FLAGS_enable_debugprint_log) { + debugging::DebugPrint("(DebugPrint) %s\n", str); + } + return 0; }