Preserving HIR disasm when the debugger is attached.

This commit is contained in:
Ben Vanik 2015-06-16 21:04:18 -07:00
parent 165d49ad3a
commit aae45515ae
4 changed files with 15 additions and 7 deletions

View File

@ -17,7 +17,6 @@ DECLARE_string(cpu);
DECLARE_string(load_module_map); DECLARE_string(load_module_map);
DECLARE_bool(debug); DECLARE_bool(debug);
DECLARE_bool(always_disasm);
DECLARE_bool(disassemble_functions); DECLARE_bool(disassemble_functions);
DECLARE_bool(trace_functions); DECLARE_bool(trace_functions);

View File

@ -24,9 +24,6 @@ DEFINE_string(
DEFINE_bool(debug, DEFAULT_DEBUG_FLAG, DEFINE_bool(debug, DEFAULT_DEBUG_FLAG,
"Allow debugging and retain debug information."); "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, DEFINE_bool(disassemble_functions, false,
"Disassemble functions during generation."); "Disassemble functions during generation.");

View File

@ -9,6 +9,8 @@
#include "xenia/cpu/frontend/ppc_translator.h" #include "xenia/cpu/frontend/ppc_translator.h"
#include <gflags/gflags.h>
#include "xenia/base/assert.h" #include "xenia/base/assert.h"
#include "xenia/base/byte_order.h" #include "xenia/base/byte_order.h"
#include "xenia/base/memory.h" #include "xenia/base/memory.h"
@ -24,6 +26,9 @@
#include "xenia/debug/debugger.h" #include "xenia/debug/debugger.h"
#include "xenia/profiling.h" #include "xenia/profiling.h"
DEFINE_bool(preserve_hir_disasm, true,
"Preserves HIR disassembly for the debugger when it is attached.");
namespace xe { namespace xe {
namespace cpu { namespace cpu {
namespace frontend { namespace frontend {
@ -104,7 +109,12 @@ bool PPCTranslator::Translate(FunctionInfo* symbol_info,
xe::make_reset_scope(&string_buffer_); xe::make_reset_scope(&string_buffer_);
// NOTE: we only want to do this when required, as it's expensive to build. // 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; debug_info_flags |= DebugInfoFlags::kDebugInfoAllDisasm;
} }
if (FLAGS_trace_functions) { if (FLAGS_trace_functions) {

View File

@ -81,6 +81,8 @@ class Debugger {
uint8_t* AllocateFunctionData(size_t size); uint8_t* AllocateFunctionData(size_t size);
uint8_t* AllocateFunctionTraceData(size_t size); uint8_t* AllocateFunctionTraceData(size_t size);
bool is_attached() const { return client_socket_ != ~0; }
bool SuspendAllThreads(); bool SuspendAllThreads();
bool ResumeThread(uint32_t thread_id); bool ResumeThread(uint32_t thread_id);
bool ResumeAllThreads(); bool ResumeAllThreads();
@ -108,10 +110,10 @@ class Debugger {
Emulator* emulator_; Emulator* emulator_;
UINT_PTR listen_socket_; uintptr_t listen_socket_;
std::thread accept_thread_; std::thread accept_thread_;
xe::threading::Fence accept_fence_; xe::threading::Fence accept_fence_;
UINT_PTR client_socket_; uintptr_t client_socket_;
std::thread receive_thread_; std::thread receive_thread_;
std::wstring functions_path_; std::wstring functions_path_;