diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-07-05 10:24:19 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-07-05 10:24:19 +0200 |
| commit | af6d1735afe4b63d13ddb73f532b4a3309f527c2 (patch) | |
| tree | 5ae95a116c16e990146495d30d2fd13e4474e663 /dev/LibDebugger | |
| parent | 3539f86015f3363dcfb124aa020d3adf7345ffaa (diff) | |
LibDebugger: refactor! Breaking changes inside the debugger contracts.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/LibDebugger')
| -rw-r--r-- | dev/LibDebugger/CommonCLI.inl | 6 | ||||
| -rw-r--r-- | dev/LibDebugger/DebuggerContract.h | 2 | ||||
| -rw-r--r-- | dev/LibDebugger/NeKernelContract.h | 19 | ||||
| -rw-r--r-- | dev/LibDebugger/POSIXMachContract.h | 2 | ||||
| -rw-r--r-- | dev/LibDebugger/src/NeKernelContract.cc | 5 | ||||
| -rw-r--r-- | dev/LibDebugger/src/NeKernelContractCLI.cc | 8 | ||||
| -rw-r--r-- | dev/LibDebugger/src/POSIXMachContractCLI.cc | 6 |
7 files changed, 23 insertions, 25 deletions
diff --git a/dev/LibDebugger/CommonCLI.inl b/dev/LibDebugger/CommonCLI.inl index 01bbb82..9c4942a 100644 --- a/dev/LibDebugger/CommonCLI.inl +++ b/dev/LibDebugger/CommonCLI.inl @@ -1,3 +1,9 @@ +/*** + LibDebugger + (C) 2025 Amlal El Mahrouss + File: CommonCLI.inl + Purpose: Common Debugger symbols. +*/ static BOOL kKeepRunning = false; diff --git a/dev/LibDebugger/DebuggerContract.h b/dev/LibDebugger/DebuggerContract.h index 0f4bc10..c9b269f 100644 --- a/dev/LibDebugger/DebuggerContract.h +++ b/dev/LibDebugger/DebuggerContract.h @@ -30,7 +30,7 @@ class DebuggerContract { public: virtual bool Attach(std::string path, std::string argv, ProcessID& pid) noexcept = 0; - virtual bool Breakpoint(std::string symbol) noexcept = 0; + virtual bool BreakAt(std::string symbol) noexcept = 0; virtual bool Break() noexcept = 0; virtual bool Continue() noexcept = 0; virtual bool Detach() noexcept = 0; diff --git a/dev/LibDebugger/NeKernelContract.h b/dev/LibDebugger/NeKernelContract.h index 78140e7..80bf2b5 100644 --- a/dev/LibDebugger/NeKernelContract.h +++ b/dev/LibDebugger/NeKernelContract.h @@ -31,18 +31,8 @@ namespace LibDebugger::NeKernel { class NeKernelContract; namespace Detail { - class NeKernelDebugHeader; - inline constexpr size_t kDebugTypeLen = 256U; - - typedef char rt_debug_type[kDebugTypeLen]; - - class NeKernelDebugHeader final { - public: - int16_t fPort; - int16_t fPortKind; - rt_debug_type fPortBlob; - }; + typedef char rt_debug_type[kDebugTypeLen]; } // namespace Detail class NeKernelContract : public DebuggerContract { @@ -55,15 +45,16 @@ class NeKernelContract : public DebuggerContract { NeKernelContract(const NeKernelContract&) = default; // Override additional methods from DebuggerContract + + public: bool Attach(std::string path, std::string argv, ProcessID& pid) noexcept override; - bool Breakpoint(std::string symbol) noexcept override; + bool BreakAt(std::string symbol) noexcept override; bool Break() noexcept override; bool Continue() noexcept override; bool Detach() noexcept override; private: - std::string m_ip_address; - std::string m_port; + std::string m_kernel_path; int64_t m_socket{0}; }; } // namespace LibDebugger::NeKernel diff --git a/dev/LibDebugger/POSIXMachContract.h b/dev/LibDebugger/POSIXMachContract.h index 1d7561a..98085a2 100644 --- a/dev/LibDebugger/POSIXMachContract.h +++ b/dev/LibDebugger/POSIXMachContract.h @@ -90,7 +90,7 @@ class POSIXMachContract : public DebuggerContract { m_path = path; } - BOOL Breakpoint(std::string symbol) noexcept override { + BOOL BreakAt(std::string symbol) noexcept override { if (!m_path.empty() && std::filesystem::exists(m_path) && std::filesystem::is_regular_file(m_path)) { auto handle = dlopen(m_path.c_str(), RTLD_LAZY); diff --git a/dev/LibDebugger/src/NeKernelContract.cc b/dev/LibDebugger/src/NeKernelContract.cc index bc93a46..075a1cb 100644 --- a/dev/LibDebugger/src/NeKernelContract.cc +++ b/dev/LibDebugger/src/NeKernelContract.cc @@ -19,11 +19,12 @@ NeKernelContract::NeKernelContract() = default; NeKernelContract::~NeKernelContract() = default; -bool NeKernelContract::Attach(LibCompiler::STLString path, LibCompiler::STLString argv, ProcessID& pid) noexcept { +bool NeKernelContract::Attach(LibCompiler::STLString path, LibCompiler::STLString argv, + ProcessID& pid) noexcept { return false; } -bool NeKernelContract::Breakpoint(LibCompiler::STLString symbol) noexcept { +bool NeKernelContract::BreakAt(LibCompiler::STLString symbol) noexcept { return false; } diff --git a/dev/LibDebugger/src/NeKernelContractCLI.cc b/dev/LibDebugger/src/NeKernelContractCLI.cc index ec73788..25e9c13 100644 --- a/dev/LibDebugger/src/NeKernelContractCLI.cc +++ b/dev/LibDebugger/src/NeKernelContractCLI.cc @@ -23,7 +23,7 @@ static void dbgi_ctrlc_handler(std::int32_t _) { kKernelDebugger.Break(); - pfd::notify("Debugger Event", "Breakpoint hit!"); + pfd::notify("Debugger Event", "BreakAt hit!"); kKeepRunning = false; } @@ -43,7 +43,7 @@ LIBCOMPILER_MODULE(DebuggerNeKernel) { LibCompiler::install_signal(SIGINT, dbgi_ctrlc_handler); kKernelDebugger.Attach(kPath, "", kPID); - kKernelDebugger.Breakpoint("$HANDOVER_START"); + kKernelDebugger.BreakAt("$HANDOVER_START"); while (YES) { if (kKeepRunning) { @@ -83,8 +83,8 @@ LIBCOMPILER_MODULE(DebuggerNeKernel) { std::getline(std::cin, cmd); - if (kKernelDebugger.Breakpoint(cmd)) { - pfd::notify("Debugger Event", "Add Breakpoint at: " + cmd); + if (kKernelDebugger.BreakAt(cmd)) { + pfd::notify("Debugger Event", "Add BreakAt at: " + cmd); } } } diff --git a/dev/LibDebugger/src/POSIXMachContractCLI.cc b/dev/LibDebugger/src/POSIXMachContractCLI.cc index d754643..a45b52d 100644 --- a/dev/LibDebugger/src/POSIXMachContractCLI.cc +++ b/dev/LibDebugger/src/POSIXMachContractCLI.cc @@ -25,7 +25,7 @@ static void dbgi_ctrlc_handler(std::int32_t _) { kDebugger.Break(); - pfd::notify("Debugger Event", "Breakpoint hit!"); + pfd::notify("Debugger Event", "BreakAt hit!"); kKeepRunning = false; } @@ -81,8 +81,8 @@ LIBCOMPILER_MODULE(DebuggerMachPOSIX) { std::getline(std::cin, cmd); - if (kDebugger.Breakpoint(cmd)) { - pfd::notify("Debugger Event", "Add Breakpoint at: " + cmd); + if (kDebugger.BreakAt(cmd)) { + pfd::notify("Debugger Event", "Add BreakAt at: " + cmd); } } } |
