From f4a3ae900294759eb79307137a1efa9e2fbe2a10 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sun, 23 Mar 2025 11:10:06 +0100 Subject: debugger(posix): Refactor LibDebugger POSIX engine: rename, namespace update, API cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Renamed `IDebuggerEngine.h` → `POSIX.h` and `DebuggerEnginePOSIX.cc` → `POSIX.cc` - Moved `IDebuggerEngine` class into `LibDebugger::POSIX` namespace and renamed it to `Debugger` - Simplified method names: - `SetBreakpoint` → `Break` - `ContinueExecution` → `Continue` - Replaced generic return codes with `EXIT_SUCCESS` / `EXIT_FAILURE` - Updated includes and symbol usage to reflect changes across the codebase Signed-off-by: Amlal El Mahrouss --- dev/LibDebugger/src/DebuggerEnginePOSIX.cc | 70 ------------------------------ 1 file changed, 70 deletions(-) delete mode 100644 dev/LibDebugger/src/DebuggerEnginePOSIX.cc (limited to 'dev/LibDebugger/src/DebuggerEnginePOSIX.cc') diff --git a/dev/LibDebugger/src/DebuggerEnginePOSIX.cc b/dev/LibDebugger/src/DebuggerEnginePOSIX.cc deleted file mode 100644 index b8695fb..0000000 --- a/dev/LibDebugger/src/DebuggerEnginePOSIX.cc +++ /dev/null @@ -1,70 +0,0 @@ -/*** - (C) 2025 Amlal El Mahrouss - */ - -#include -#include - -#ifndef _WIN32 - -LIBCOMPILER_MODULE(DebuggerPOSIX) -{ - LibDebugger::IDebuggerEngine debugger; - pid_t pid = 0L; - - if (argc >= 3 && std::string(argv[1]) == "-p" && - argv[2] != nullptr) - { - pid = std::stoi(argv[2]); - debugger.Attach(pid); - } - - while (YES) - { - std::string cmd; - std::getline(std::cin, cmd); - - if (cmd == "c" || - cmd == "cont") - debugger.ContinueExecution(); - - if (cmd == "d" || - cmd == "detach") - debugger.Detach(); - - if (cmd == "attach") - { - std::cout << "[?] Enter a PID to attach on: "; - - std::getline(std::cin, cmd); - pid = std::stoi(cmd.c_str()); - - debugger.Attach(pid); - } - - if (cmd == "exit") - { - if (pid > 0) - debugger.Detach(); - - break; - } - - if (cmd == "break" || - cmd == "b") - { - std::cout << "[?] Enter an address to add a breakpoint on: "; - - std::getline(std::cin, cmd); - - LibDebugger::CAddr breakpoint_addr = reinterpret_cast(std::stoul(cmd.c_str(), nullptr, 16)); - - if (breakpoint_addr) - debugger.SetBreakpoint(breakpoint_addr); - } - } - - return 0; -} - -#endif \ No newline at end of file -- cgit v1.2.3