Shuffling --debug around and making it work.
This commit is contained in:
parent
2f233c7974
commit
a42ab648ed
|
@ -9,10 +9,10 @@
|
||||||
|
|
||||||
#include "xenia/cpu/backend/x64/x64_emitter.h"
|
#include "xenia/cpu/backend/x64/x64_emitter.h"
|
||||||
|
|
||||||
#include <cstring>
|
|
||||||
|
|
||||||
#include <gflags/gflags.h>
|
#include <gflags/gflags.h>
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
#include "xenia/base/assert.h"
|
#include "xenia/base/assert.h"
|
||||||
#include "xenia/base/atomic.h"
|
#include "xenia/base/atomic.h"
|
||||||
#include "xenia/base/debugging.h"
|
#include "xenia/base/debugging.h"
|
||||||
|
@ -30,6 +30,7 @@
|
||||||
#include "xenia/cpu/processor.h"
|
#include "xenia/cpu/processor.h"
|
||||||
#include "xenia/cpu/symbol_info.h"
|
#include "xenia/cpu/symbol_info.h"
|
||||||
#include "xenia/cpu/thread_state.h"
|
#include "xenia/cpu/thread_state.h"
|
||||||
|
#include "xenia/debug/debugger.h"
|
||||||
#include "xenia/profiling.h"
|
#include "xenia/profiling.h"
|
||||||
|
|
||||||
DEFINE_bool(enable_debugprint_log, false,
|
DEFINE_bool(enable_debugprint_log, false,
|
||||||
|
|
|
@ -16,14 +16,6 @@ DEFINE_string(
|
||||||
"Loads a .map for symbol names and to diff with the generated symbol "
|
"Loads a .map for symbol names and to diff with the generated symbol "
|
||||||
"database.");
|
"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,
|
DEFINE_bool(disassemble_functions, false,
|
||||||
"Disassemble functions during generation.");
|
"Disassemble functions during generation.");
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@ DECLARE_string(cpu);
|
||||||
|
|
||||||
DECLARE_string(load_module_map);
|
DECLARE_string(load_module_map);
|
||||||
|
|
||||||
DECLARE_bool(debug);
|
|
||||||
DECLARE_bool(disassemble_functions);
|
DECLARE_bool(disassemble_functions);
|
||||||
|
|
||||||
DECLARE_bool(trace_functions);
|
DECLARE_bool(trace_functions);
|
||||||
|
|
|
@ -27,6 +27,14 @@
|
||||||
#include "xenia/kernel/objects/xthread.h"
|
#include "xenia/kernel/objects/xthread.h"
|
||||||
#include "xenia/kernel/objects/xuser_module.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_string(debug_session_path, "", "Debug output path.");
|
||||||
DEFINE_bool(wait_for_debugger, false,
|
DEFINE_bool(wait_for_debugger, false,
|
||||||
"Waits for a debugger to attach before starting the game.");
|
"Waits for a debugger to attach before starting the game.");
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
#ifndef XENIA_DEBUG_DEBUGGER_H_
|
#ifndef XENIA_DEBUG_DEBUGGER_H_
|
||||||
#define XENIA_DEBUG_DEBUGGER_H_
|
#define XENIA_DEBUG_DEBUGGER_H_
|
||||||
|
|
||||||
|
#include <gflags/gflags.h>
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
@ -23,6 +25,8 @@
|
||||||
#include "xenia/cpu/thread_state.h"
|
#include "xenia/cpu/thread_state.h"
|
||||||
#include "xenia/debug/breakpoint.h"
|
#include "xenia/debug/breakpoint.h"
|
||||||
|
|
||||||
|
DECLARE_bool(debug);
|
||||||
|
|
||||||
namespace xe {
|
namespace xe {
|
||||||
class Emulator;
|
class Emulator;
|
||||||
} // namespace xe
|
} // namespace xe
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#include "xenia/base/logging.h"
|
#include "xenia/base/logging.h"
|
||||||
#include "xenia/debug/debugger.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 xe {
|
||||||
namespace debug {
|
namespace debug {
|
||||||
|
|
|
@ -46,8 +46,10 @@ Emulator::Emulator(const std::wstring& command_line)
|
||||||
Emulator::~Emulator() {
|
Emulator::~Emulator() {
|
||||||
// Note that we delete things in the reverse order they were initialized.
|
// Note that we delete things in the reverse order they were initialized.
|
||||||
|
|
||||||
|
if (debugger_) {
|
||||||
// Kill the debugger first, so that we don't have it messing with things.
|
// Kill the debugger first, so that we don't have it messing with things.
|
||||||
debugger_->StopSession();
|
debugger_->StopSession();
|
||||||
|
}
|
||||||
|
|
||||||
// Give the systems time to shutdown before we delete them.
|
// Give the systems time to shutdown before we delete them.
|
||||||
graphics_system_->Shutdown();
|
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.
|
// Shared export resolver used to attach and query for HLE exports.
|
||||||
export_resolver_ = std::make_unique<xe::cpu::ExportResolver>();
|
export_resolver_ = std::make_unique<xe::cpu::ExportResolver>();
|
||||||
|
|
||||||
|
if (FLAGS_debug) {
|
||||||
// Debugger first, as other parts hook into it.
|
// Debugger first, as other parts hook into it.
|
||||||
debugger_.reset(new debug::Debugger(this));
|
debugger_.reset(new debug::Debugger(this));
|
||||||
|
|
||||||
// Create debugger first. Other types hook up to it.
|
// Create debugger first. Other types hook up to it.
|
||||||
debugger_->StartSession();
|
debugger_->StartSession();
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize the CPU.
|
// Initialize the CPU.
|
||||||
processor_ = std::make_unique<Processor>(
|
processor_ = std::make_unique<Processor>(
|
||||||
|
|
|
@ -111,9 +111,7 @@ uint32_t XThread::GetCurrentThreadId() {
|
||||||
return thread->guest_object<X_KTHREAD>()->thread_id;
|
return thread->guest_object<X_KTHREAD>()->thread_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t XThread::last_error() {
|
uint32_t XThread::last_error() { return guest_object<X_KTHREAD>()->last_error; }
|
||||||
return guest_object<X_KTHREAD>()->last_error;
|
|
||||||
}
|
|
||||||
|
|
||||||
void XThread::set_last_error(uint32_t error_code) {
|
void XThread::set_last_error(uint32_t error_code) {
|
||||||
guest_object<X_KTHREAD>()->last_error = error_code;
|
guest_object<X_KTHREAD>()->last_error = error_code;
|
||||||
|
|
|
@ -158,9 +158,7 @@ bool Win32Window::set_title(const std::wstring& title) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Win32Window::is_fullscreen() const {
|
bool Win32Window::is_fullscreen() const { return fullscreen_; }
|
||||||
return fullscreen_;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Win32Window::ToggleFullscreen(bool fullscreen) {
|
void Win32Window::ToggleFullscreen(bool fullscreen) {
|
||||||
if (fullscreen == is_fullscreen()) {
|
if (fullscreen == is_fullscreen()) {
|
||||||
|
|
Loading…
Reference in New Issue