diff --git a/src/xenia/cpu/backend/x64/x64_emitter.cc b/src/xenia/cpu/backend/x64/x64_emitter.cc index 928bdb4d6..d43b9bcff 100644 --- a/src/xenia/cpu/backend/x64/x64_emitter.cc +++ b/src/xenia/cpu/backend/x64/x64_emitter.cc @@ -9,10 +9,10 @@ #include "xenia/cpu/backend/x64/x64_emitter.h" -#include - #include +#include + #include "xenia/base/assert.h" #include "xenia/base/atomic.h" #include "xenia/base/debugging.h" @@ -30,6 +30,7 @@ #include "xenia/cpu/processor.h" #include "xenia/cpu/symbol_info.h" #include "xenia/cpu/thread_state.h" +#include "xenia/debug/debugger.h" #include "xenia/profiling.h" DEFINE_bool(enable_debugprint_log, false, diff --git a/src/xenia/cpu/cpu_flags.cc b/src/xenia/cpu/cpu_flags.cc index a9831b328..0d1748c1a 100644 --- a/src/xenia/cpu/cpu_flags.cc +++ b/src/xenia/cpu/cpu_flags.cc @@ -16,14 +16,6 @@ DEFINE_string( "Loads a .map for symbol names and to diff with the generated symbol " "database."); -#if 0 && DEBUG -#define DEFAULT_DEBUG_FLAG true -#else -#define DEFAULT_DEBUG_FLAG false -#endif - -DEFINE_bool(debug, DEFAULT_DEBUG_FLAG, - "Allow debugging and retain debug information."); DEFINE_bool(disassemble_functions, false, "Disassemble functions during generation."); diff --git a/src/xenia/cpu/cpu_flags.h b/src/xenia/cpu/cpu_flags.h index aba900a1e..578429b74 100644 --- a/src/xenia/cpu/cpu_flags.h +++ b/src/xenia/cpu/cpu_flags.h @@ -16,7 +16,6 @@ DECLARE_string(cpu); DECLARE_string(load_module_map); -DECLARE_bool(debug); DECLARE_bool(disassemble_functions); DECLARE_bool(trace_functions); diff --git a/src/xenia/debug/debugger.cc b/src/xenia/debug/debugger.cc index ad10b17b6..54f26b799 100644 --- a/src/xenia/debug/debugger.cc +++ b/src/xenia/debug/debugger.cc @@ -27,6 +27,14 @@ #include "xenia/kernel/objects/xthread.h" #include "xenia/kernel/objects/xuser_module.h" +#if 0 && DEBUG +#define DEFAULT_DEBUG_FLAG true +#else +#define DEFAULT_DEBUG_FLAG false +#endif + +DEFINE_bool(debug, DEFAULT_DEBUG_FLAG, + "Allow debugging and retain debug information."); DEFINE_string(debug_session_path, "", "Debug output path."); DEFINE_bool(wait_for_debugger, false, "Waits for a debugger to attach before starting the game."); diff --git a/src/xenia/debug/debugger.h b/src/xenia/debug/debugger.h index a1dc02bd7..843cc8a5e 100644 --- a/src/xenia/debug/debugger.h +++ b/src/xenia/debug/debugger.h @@ -10,6 +10,8 @@ #ifndef XENIA_DEBUG_DEBUGGER_H_ #define XENIA_DEBUG_DEBUGGER_H_ +#include + #include #include #include @@ -23,6 +25,8 @@ #include "xenia/cpu/thread_state.h" #include "xenia/debug/breakpoint.h" +DECLARE_bool(debug); + namespace xe { class Emulator; } // namespace xe diff --git a/src/xenia/debug/transport/gdb/gdb_transport.cc b/src/xenia/debug/transport/gdb/gdb_transport.cc index c5fc7ee44..bb8313715 100644 --- a/src/xenia/debug/transport/gdb/gdb_transport.cc +++ b/src/xenia/debug/transport/gdb/gdb_transport.cc @@ -14,7 +14,7 @@ #include "xenia/base/logging.h" #include "xenia/debug/debugger.h" -DEFINE_int32(gdb_port, 9000, "Debugger GDB server TCP port."); +DEFINE_int32(gdb_port, 9000, "Debugger gdbserver TCP port."); namespace xe { namespace debug { diff --git a/src/xenia/emulator.cc b/src/xenia/emulator.cc index c03a97012..bf02743b0 100644 --- a/src/xenia/emulator.cc +++ b/src/xenia/emulator.cc @@ -46,8 +46,10 @@ Emulator::Emulator(const std::wstring& command_line) Emulator::~Emulator() { // Note that we delete things in the reverse order they were initialized. - // Kill the debugger first, so that we don't have it messing with things. - debugger_->StopSession(); + if (debugger_) { + // Kill the debugger first, so that we don't have it messing with things. + debugger_->StopSession(); + } // Give the systems time to shutdown before we delete them. graphics_system_->Shutdown(); @@ -96,11 +98,13 @@ X_STATUS Emulator::Setup(ui::Window* display_window) { // Shared export resolver used to attach and query for HLE exports. export_resolver_ = std::make_unique(); - // Debugger first, as other parts hook into it. - debugger_.reset(new debug::Debugger(this)); + if (FLAGS_debug) { + // Debugger first, as other parts hook into it. + debugger_.reset(new debug::Debugger(this)); - // Create debugger first. Other types hook up to it. - debugger_->StartSession(); + // Create debugger first. Other types hook up to it. + debugger_->StartSession(); + } // Initialize the CPU. processor_ = std::make_unique( diff --git a/src/xenia/kernel/objects/xthread.cc b/src/xenia/kernel/objects/xthread.cc index 1a5993036..0df954287 100644 --- a/src/xenia/kernel/objects/xthread.cc +++ b/src/xenia/kernel/objects/xthread.cc @@ -111,9 +111,7 @@ uint32_t XThread::GetCurrentThreadId() { return thread->guest_object()->thread_id; } -uint32_t XThread::last_error() { - return guest_object()->last_error; -} +uint32_t XThread::last_error() { return guest_object()->last_error; } void XThread::set_last_error(uint32_t error_code) { guest_object()->last_error = error_code; diff --git a/src/xenia/ui/window_win.cc b/src/xenia/ui/window_win.cc index 7be2b1128..b232171cd 100644 --- a/src/xenia/ui/window_win.cc +++ b/src/xenia/ui/window_win.cc @@ -158,9 +158,7 @@ bool Win32Window::set_title(const std::wstring& title) { return true; } -bool Win32Window::is_fullscreen() const { - return fullscreen_; -} +bool Win32Window::is_fullscreen() const { return fullscreen_; } void Win32Window::ToggleFullscreen(bool fullscreen) { if (fullscreen == is_fullscreen()) {