From befde76cfa46c766e81f74eb5ac65d3dae2dde87 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sat, 19 Apr 2025 17:33:26 +0200 Subject: dev, LibCompiler, tooling: refactor and separate components into modules (cppdrv, cxxdrv) Signed-off-by: Amlal El Mahrouss --- dev/LibDebugger/DebuggerContract.h | 14 +++++++------- dev/LibDebugger/POSIXMachContract.h | 11 ++++++----- dev/LibDebugger/src/POSIXMachContract.cc | 6 +++--- 3 files changed, 16 insertions(+), 15 deletions(-) (limited to 'dev/LibDebugger') diff --git a/dev/LibDebugger/DebuggerContract.h b/dev/LibDebugger/DebuggerContract.h index 5d4f728..540ad08 100644 --- a/dev/LibDebugger/DebuggerContract.h +++ b/dev/LibDebugger/DebuggerContract.h @@ -9,8 +9,8 @@ namespace LibDebugger { - typedef uint64_t ProcessID; - typedef char* CAddress; + typedef uint64_t ProcessID; + typedef char* CAddress; /// \brief Debugger contract class in C++, as per the design states. /// \author Amlal El Mahrouss @@ -18,7 +18,7 @@ namespace LibDebugger { public: explicit DebuggerContract() = default; - virtual ~DebuggerContract() = default; + virtual ~DebuggerContract() = default; public: DebuggerContract& operator=(const DebuggerContract&) = default; @@ -26,9 +26,9 @@ namespace LibDebugger public: virtual bool Attach(ProcessID pid) noexcept = 0; - virtual bool Break(CAddress addr) noexcept = 0; - virtual bool Continue() noexcept = 0; - virtual bool Detach() noexcept = 0; + virtual bool Break(CAddress addr) noexcept = 0; + virtual bool Continue() noexcept = 0; + virtual bool Detach() noexcept = 0; virtual std::unordered_map& Get() { @@ -39,4 +39,4 @@ namespace LibDebugger pid_t m_pid; std::unordered_map m_breakpoints; }; -} // namespace LibDebugger::POSIX +} // namespace LibDebugger diff --git a/dev/LibDebugger/POSIXMachContract.h b/dev/LibDebugger/POSIXMachContract.h index 6ff083f..1962202 100644 --- a/dev/LibDebugger/POSIXMachContract.h +++ b/dev/LibDebugger/POSIXMachContract.h @@ -12,6 +12,7 @@ /// @brief POSIX/Mach debugger. #include +#include #include #include @@ -35,7 +36,7 @@ namespace LibDebugger::POSIX { /// \brief POSIXMachContract engine interface class in C++ /// \author Amlal El Mahrouss - class POSIXMachContract final : public DebuggerContract + class POSIXMachContract : public DebuggerContract { public: explicit POSIXMachContract() = default; @@ -46,7 +47,7 @@ namespace LibDebugger::POSIX POSIXMachContract(const POSIXMachContract&) = default; public: - bool Attach(ProcessID pid) noexcept override + BOOL Attach(ProcessID pid) noexcept override { #ifdef __APPLE__ if (pid == 0) @@ -69,7 +70,7 @@ namespace LibDebugger::POSIX #endif } - bool Break(CAddress addr) noexcept override + BOOL Break(CAddress addr) noexcept override { #ifdef __APPLE__ task_read_t task; @@ -100,7 +101,7 @@ namespace LibDebugger::POSIX #endif } - bool Continue() noexcept override + BOOL Continue() noexcept override { #ifdef __APPLE__ task_read_t task; @@ -122,7 +123,7 @@ namespace LibDebugger::POSIX #endif } - bool Detach() noexcept override + BOOL Detach() noexcept override { #ifdef __APPLE__ this->Continue(); diff --git a/dev/LibDebugger/src/POSIXMachContract.cc b/dev/LibDebugger/src/POSIXMachContract.cc index 4e7212c..cfce841 100644 --- a/dev/LibDebugger/src/POSIXMachContract.cc +++ b/dev/LibDebugger/src/POSIXMachContract.cc @@ -10,9 +10,9 @@ #ifndef _WIN32 -static bool kKeepRunning = false; +static BOOL kKeepRunning = false; static LibDebugger::POSIX::POSIXMachContract kDebugger; -static pid_t kPID = 0L; +static LibDebugger::ProcessID kPID = 0L; static LibDebugger::CAddress kActiveAddress = nullptr; /// @internal @@ -33,7 +33,7 @@ static void dbgi_ctrlc_handler(std::int32_t _) kKeepRunning = false; } -LIBCOMPILER_MODULE(DebuggerPOSIX) +LIBCOMPILER_MODULE(DebuggerMachPOSIX) { pfd::notify("Debugger Event", "NeKernel Debugger\n(C) 2025 Amlal El Mahrouss, all rights reserved."); -- cgit v1.2.3