mirror of
https://github.com/momo5502/emulator.git
synced 2026-01-18 03:13:55 +00:00
Report application exit
This commit is contained in:
@@ -204,6 +204,13 @@ namespace gdb_stub
|
||||
|
||||
void signal_stop(const debugging_context& c)
|
||||
{
|
||||
const auto exit_status = c.handler.get_exit_code();
|
||||
if (exit_status)
|
||||
{
|
||||
c.connection.send_reply(*exit_status == 0 ? "W00" : "WFF");
|
||||
return;
|
||||
}
|
||||
|
||||
const auto id = c.handler.get_current_thread_id();
|
||||
const auto hex_id = utils::string::to_hex_number(id);
|
||||
c.connection.send_reply("T05thread:" + hex_id + ";");
|
||||
|
||||
@@ -48,6 +48,8 @@ namespace gdb_stub
|
||||
|
||||
virtual uint32_t get_current_thread_id() = 0;
|
||||
virtual std::vector<uint32_t> get_thread_ids() = 0;
|
||||
|
||||
virtual std::optional<uint32_t> get_exit_code() = 0;
|
||||
};
|
||||
|
||||
bool run_gdb_stub(const network::address& bind_address, debugging_handler& handler);
|
||||
|
||||
@@ -68,6 +68,17 @@ class win_x64_gdb_stub_handler : public x64_gdb_stub_handler
|
||||
return this->win_emu_->activate_thread(thread_id);
|
||||
}
|
||||
|
||||
std::optional<uint32_t> get_exit_code() override
|
||||
{
|
||||
const auto status = this->win_emu_->process().exit_status;
|
||||
if (!status)
|
||||
{
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
return static_cast<uint32_t>(*status);
|
||||
}
|
||||
|
||||
private:
|
||||
windows_emulator* win_emu_{};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user