diff --git a/src/xenia/cpu/cpu-private.h b/src/xenia/cpu/cpu-private.h index 2288b6769..d28472d71 100644 --- a/src/xenia/cpu/cpu-private.h +++ b/src/xenia/cpu/cpu-private.h @@ -17,7 +17,6 @@ DECLARE_string(cpu); DECLARE_string(load_module_map); DECLARE_bool(debug); -DECLARE_bool(always_disasm); DECLARE_bool(disassemble_functions); DECLARE_bool(trace_functions); diff --git a/src/xenia/cpu/cpu.cc b/src/xenia/cpu/cpu.cc index f9e24bfdf..7c8446c18 100644 --- a/src/xenia/cpu/cpu.cc +++ b/src/xenia/cpu/cpu.cc @@ -24,9 +24,6 @@ DEFINE_string( DEFINE_bool(debug, DEFAULT_DEBUG_FLAG, "Allow debugging and retain debug information."); -DEFINE_bool( - always_disasm, false, - "Always add debug info to functions, even when no debugger is attached."); DEFINE_bool(disassemble_functions, false, "Disassemble functions during generation."); diff --git a/src/xenia/cpu/frontend/ppc_translator.cc b/src/xenia/cpu/frontend/ppc_translator.cc index 2e51280ee..d110e9840 100644 --- a/src/xenia/cpu/frontend/ppc_translator.cc +++ b/src/xenia/cpu/frontend/ppc_translator.cc @@ -9,6 +9,8 @@ #include "xenia/cpu/frontend/ppc_translator.h" +#include + #include "xenia/base/assert.h" #include "xenia/base/byte_order.h" #include "xenia/base/memory.h" @@ -24,6 +26,9 @@ #include "xenia/debug/debugger.h" #include "xenia/profiling.h" +DEFINE_bool(preserve_hir_disasm, true, + "Preserves HIR disassembly for the debugger when it is attached."); + namespace xe { namespace cpu { namespace frontend { @@ -104,7 +109,12 @@ bool PPCTranslator::Translate(FunctionInfo* symbol_info, xe::make_reset_scope(&string_buffer_); // NOTE: we only want to do this when required, as it's expensive to build. - if (FLAGS_always_disasm) { + if (FLAGS_preserve_hir_disasm && + frontend_->processor()->debugger()->is_attached()) { + debug_info_flags |= DebugInfoFlags::kDebugInfoDisasmRawHir | + DebugInfoFlags::kDebugInfoDisasmHir; + } + if (FLAGS_disassemble_functions) { debug_info_flags |= DebugInfoFlags::kDebugInfoAllDisasm; } if (FLAGS_trace_functions) { diff --git a/src/xenia/debug/debugger.h b/src/xenia/debug/debugger.h index 93e869e60..9bb446679 100644 --- a/src/xenia/debug/debugger.h +++ b/src/xenia/debug/debugger.h @@ -81,6 +81,8 @@ class Debugger { uint8_t* AllocateFunctionData(size_t size); uint8_t* AllocateFunctionTraceData(size_t size); + bool is_attached() const { return client_socket_ != ~0; } + bool SuspendAllThreads(); bool ResumeThread(uint32_t thread_id); bool ResumeAllThreads(); @@ -108,10 +110,10 @@ class Debugger { Emulator* emulator_; - UINT_PTR listen_socket_; + uintptr_t listen_socket_; std::thread accept_thread_; xe::threading::Fence accept_fence_; - UINT_PTR client_socket_; + uintptr_t client_socket_; std::thread receive_thread_; std::wstring functions_path_;