A new debugger.
Lots of bugs/rough edges/etc - issues will be filed. Old-style debugging still works (just use --emit_source_annotations to get the helpful movs back and --break_on_instruction will still fire).
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include "xenia/app/emulator_window.h"
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/main.h"
|
||||
#include "xenia/debug/ui/debug_window.h"
|
||||
#include "xenia/emulator.h"
|
||||
#include "xenia/profiling.h"
|
||||
#include "xenia/ui/file_picker.h"
|
||||
@@ -39,6 +40,27 @@ int xenia_main(const std::vector<std::wstring>& args) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Set a debug handler.
|
||||
// This will respond to debugging requests so we can open the debug UI.
|
||||
std::unique_ptr<xe::debug::ui::DebugWindow> debug_window;
|
||||
if (emulator->debugger()) {
|
||||
emulator->debugger()->set_debug_listener_request_handler([&](
|
||||
xe::debug::Debugger* debugger) {
|
||||
if (debug_window) {
|
||||
return debug_window.get();
|
||||
}
|
||||
emulator_window->loop()->PostSynchronous([&]() {
|
||||
debug_window = xe::debug::ui::DebugWindow::Create(
|
||||
emulator.get(), emulator_window->loop());
|
||||
debug_window->window()->on_closed.AddListener([&](xe::ui::UIEvent* e) {
|
||||
emulator->debugger()->set_debug_listener(nullptr);
|
||||
emulator_window->loop()->Post([&]() { debug_window.reset(); });
|
||||
});
|
||||
});
|
||||
return debug_window.get();
|
||||
});
|
||||
}
|
||||
|
||||
// Grab path from the flag or unnamed argument.
|
||||
std::wstring path;
|
||||
if (!FLAGS_target.empty() || args.size() >= 2) {
|
||||
@@ -91,6 +113,7 @@ int xenia_main(const std::vector<std::wstring>& args) {
|
||||
emulator->display_window()->loop()->AwaitQuit();
|
||||
}
|
||||
|
||||
debug_window.reset();
|
||||
emulator.reset();
|
||||
emulator_window.reset();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user