diff --git a/src/gdb-stub/gdb_stub.cpp b/src/gdb-stub/gdb_stub.cpp index ad643428..cca0d1aa 100644 --- a/src/gdb-stub/gdb_stub.cpp +++ b/src/gdb-stub/gdb_stub.cpp @@ -50,7 +50,7 @@ namespace gdb_stub return {name, args}; } - void process_xfer(const connection_handler& connection, gdb_stub_handler& handler, + void process_xfer(const connection_handler& connection, debugging_handler& handler, const std::string_view payload) { auto [name, args] = split_string(payload, ':'); @@ -67,7 +67,7 @@ namespace gdb_stub } } - void process_query(const connection_handler& connection, gdb_stub_handler& handler, + void process_query(const connection_handler& connection, debugging_handler& handler, const std::string_view payload) { const auto [name, args] = split_string(payload, ':'); @@ -94,9 +94,9 @@ namespace gdb_stub } } - void process_action(const connection_handler& connection, const gdb_action action) + void process_action(const connection_handler& connection, const action a) { - if (action == gdb_action::shutdown) + if (a == action::shutdown) { connection.close(); } @@ -112,7 +112,7 @@ namespace gdb_stub return static_cast(type); } - bool change_breakpoint(gdb_stub_handler& handler, const bool set, const breakpoint_type type, + bool change_breakpoint(debugging_handler& handler, const bool set, const breakpoint_type type, const uint64_t address, const size_t size) { if (set) @@ -123,8 +123,8 @@ namespace gdb_stub return handler.delete_breakpoint(type, address, size); } - void handle_breakpoint(const connection_handler& connection, gdb_stub_handler& handler, const std::string& data, - const bool set) + void handle_breakpoint(const connection_handler& connection, debugging_handler& handler, + const std::string& data, const bool set) { uint32_t type{}; uint64_t addr{}; @@ -152,7 +152,7 @@ namespace gdb_stub } } - void read_registers(const connection_handler& connection, gdb_stub_handler& handler) + void read_registers(const connection_handler& connection, debugging_handler& handler) { std::string response{}; std::vector data{}; @@ -177,7 +177,7 @@ namespace gdb_stub connection.send_reply(response); } - void write_registers(const connection_handler& connection, gdb_stub_handler& handler, + void write_registers(const connection_handler& connection, debugging_handler& handler, const std::string_view payload) { const auto data = utils::string::from_hex_string(payload); @@ -208,7 +208,7 @@ namespace gdb_stub connection.send_reply("OK"); } - void read_single_register(const connection_handler& connection, gdb_stub_handler& handler, + void read_single_register(const connection_handler& connection, debugging_handler& handler, const std::string& payload) { size_t reg{}; @@ -229,7 +229,7 @@ namespace gdb_stub } } - void write_single_register(const connection_handler& connection, gdb_stub_handler& handler, + void write_single_register(const connection_handler& connection, debugging_handler& handler, const std::string_view payload) { const auto [reg, hex_data] = split_string(payload, '='); @@ -252,7 +252,7 @@ namespace gdb_stub connection.send_reply("OK"); } - void read_memory(const connection_handler& connection, gdb_stub_handler& handler, const std::string& payload) + void read_memory(const connection_handler& connection, debugging_handler& handler, const std::string& payload) { uint64_t address{}; size_t size{}; @@ -277,7 +277,7 @@ namespace gdb_stub connection.send_reply(utils::string::to_hex_string(data)); } - void write_memory(const connection_handler& connection, gdb_stub_handler& handler, + void write_memory(const connection_handler& connection, debugging_handler& handler, const std::string_view payload) { const auto [info, hex_data] = split_string(payload, ':'); @@ -331,7 +331,7 @@ namespace gdb_stub return result; } - void write_x_memory(const connection_handler& connection, gdb_stub_handler& handler, + void write_x_memory(const connection_handler& connection, debugging_handler& handler, const std::string_view payload) { const auto [info, encoded_data] = split_string(payload, ':'); @@ -359,7 +359,7 @@ namespace gdb_stub connection.send_reply("OK"); } - void handle_command(const connection_handler& connection, async_handler& async, gdb_stub_handler& handler, + void handle_command(const connection_handler& connection, async_handler& async, debugging_handler& handler, const uint8_t command, const std::string_view data) { switch (command) @@ -431,7 +431,7 @@ namespace gdb_stub } } - void process_packet(const connection_handler& connection, async_handler& async, gdb_stub_handler& handler, + void process_packet(const connection_handler& connection, async_handler& async, debugging_handler& handler, const std::string_view packet) { connection.send_raw_data("+"); @@ -451,7 +451,7 @@ namespace gdb_stub } } - bool run_gdb_stub(const network::address& bind_address, gdb_stub_handler& handler) + bool run_gdb_stub(const network::address& bind_address, debugging_handler& handler) { auto client = accept_client(bind_address); if (!client) diff --git a/src/gdb-stub/gdb_stub.hpp b/src/gdb-stub/gdb_stub.hpp index 40ce53d6..9a71b7b2 100644 --- a/src/gdb-stub/gdb_stub.hpp +++ b/src/gdb-stub/gdb_stub.hpp @@ -4,7 +4,7 @@ namespace gdb_stub { - enum class gdb_action : uint8_t + enum class action : uint8_t { none, resume, @@ -21,12 +21,12 @@ namespace gdb_stub END, }; - struct gdb_stub_handler + struct debugging_handler { - virtual ~gdb_stub_handler() = default; + virtual ~debugging_handler() = default; - virtual gdb_action run() = 0; - virtual gdb_action singlestep() = 0; + virtual action run() = 0; + virtual action singlestep() = 0; virtual size_t get_register_count() = 0; virtual size_t get_max_register_size() = 0; @@ -45,5 +45,5 @@ namespace gdb_stub virtual std::string get_target_description() = 0; }; - bool run_gdb_stub(const network::address& bind_address, gdb_stub_handler& handler); + bool run_gdb_stub(const network::address& bind_address, debugging_handler& handler); } diff --git a/src/windows-emulator/debugging/win_x64_gdb_stub_handler.hpp b/src/windows-emulator/debugging/win_x64_gdb_stub_handler.hpp index df9d1261..96b87212 100644 --- a/src/windows-emulator/debugging/win_x64_gdb_stub_handler.hpp +++ b/src/windows-emulator/debugging/win_x64_gdb_stub_handler.hpp @@ -12,7 +12,7 @@ class win_x64_gdb_stub_handler : public x64_gdb_stub_handler { } - gdb_stub::gdb_action run() override + gdb_stub::action run() override { try { @@ -23,10 +23,10 @@ class win_x64_gdb_stub_handler : public x64_gdb_stub_handler this->win_emu_->log.error("%s\n", e.what()); } - return gdb_stub::gdb_action::resume; + return gdb_stub::action::resume; } - gdb_stub::gdb_action singlestep() override + gdb_stub::action singlestep() override { try { @@ -37,7 +37,7 @@ class win_x64_gdb_stub_handler : public x64_gdb_stub_handler this->win_emu_->log.error("%s\n", e.what()); } - return gdb_stub::gdb_action::resume; + return gdb_stub::action::resume; } std::string get_target_description() override diff --git a/src/windows-emulator/debugging/x64_gdb_stub_handler.hpp b/src/windows-emulator/debugging/x64_gdb_stub_handler.hpp index fa4a15a7..0937edeb 100644 --- a/src/windows-emulator/debugging/x64_gdb_stub_handler.hpp +++ b/src/windows-emulator/debugging/x64_gdb_stub_handler.hpp @@ -58,7 +58,7 @@ struct std::hash } }; -class x64_gdb_stub_handler : public gdb_stub::gdb_stub_handler +class x64_gdb_stub_handler : public gdb_stub::debugging_handler { public: x64_gdb_stub_handler(x64_emulator& emu) @@ -68,7 +68,7 @@ class x64_gdb_stub_handler : public gdb_stub::gdb_stub_handler ~x64_gdb_stub_handler() override = default; - gdb_stub::gdb_action run() override + gdb_stub::action run() override { try { @@ -79,10 +79,10 @@ class x64_gdb_stub_handler : public gdb_stub::gdb_stub_handler puts(e.what()); } - return gdb_stub::gdb_action::resume; + return gdb_stub::action::resume; } - gdb_stub::gdb_action singlestep() override + gdb_stub::action singlestep() override { try { @@ -93,7 +93,7 @@ class x64_gdb_stub_handler : public gdb_stub::gdb_stub_handler puts(e.what()); } - return gdb_stub::gdb_action::resume; + return gdb_stub::action::resume; } size_t get_register_count() override