diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-05-02 19:38:33 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-02 19:38:33 +0200 |
| commit | 87979899ce833ca477bb563b84e3698224119dab (patch) | |
| tree | df67a0724de4c76ce594222747220c233c3bc7f5 /dev/LibDebugger/DebuggerContract.h | |
| parent | 3afc481dc64a07fe7fcaff9ce7a12a492c3ec8e7 (diff) | |
| parent | fb12b9730d78052f5cafbd84fbc9a830a22cec17 (diff) | |
Merge pull request #4 from nekernel-org/dev
0.0.1
Diffstat (limited to 'dev/LibDebugger/DebuggerContract.h')
| -rw-r--r-- | dev/LibDebugger/DebuggerContract.h | 72 |
1 files changed, 37 insertions, 35 deletions
diff --git a/dev/LibDebugger/DebuggerContract.h b/dev/LibDebugger/DebuggerContract.h index 5d4f728..0f4bc10 100644 --- a/dev/LibDebugger/DebuggerContract.h +++ b/dev/LibDebugger/DebuggerContract.h @@ -1,42 +1,44 @@ /*** - (C) 2025 Amlal El Mahrouss + (C) 2025 Amlal El Mahrouss */ #pragma once -#include <iostream> +#include <cstdint> +#include <string> #include <unordered_map> -namespace LibDebugger -{ - typedef uint64_t ProcessID; - typedef char* CAddress; - - /// \brief Debugger contract class in C++, as per the design states. - /// \author Amlal El Mahrouss - class DebuggerContract - { - public: - explicit DebuggerContract() = default; - virtual ~DebuggerContract() = default; - - public: - DebuggerContract& operator=(const DebuggerContract&) = default; - DebuggerContract(const DebuggerContract&) = default; - - 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 std::unordered_map<uintptr_t, uintptr_t>& Get() - { - return m_breakpoints; - } - - protected: - pid_t m_pid; - std::unordered_map<uintptr_t, uintptr_t> m_breakpoints; - }; -} // namespace LibDebugger::POSIX +namespace LibDebugger { +class DebuggerContract; + +/// \brief Process ID +typedef uint64_t ProcessID; + +/// \brief Address type, a la BSD. +typedef char* CAddress; + +/// \brief Debugger contract class in C++, as per the design states. +/// \author Amlal El Mahrouss +class DebuggerContract { + public: + explicit DebuggerContract() = default; + virtual ~DebuggerContract() = default; + + public: + DebuggerContract& operator=(const DebuggerContract&) = default; + DebuggerContract(const DebuggerContract&) = default; + + public: + virtual bool Attach(std::string path, std::string argv, ProcessID& pid) noexcept = 0; + virtual bool Breakpoint(std::string symbol) noexcept = 0; + virtual bool Break() noexcept = 0; + virtual bool Continue() noexcept = 0; + virtual bool Detach() noexcept = 0; + + virtual std::unordered_map<uintptr_t, uintptr_t>& Get() { return m_breakpoints; } + + protected: + ProcessID m_pid; + std::unordered_map<uintptr_t, uintptr_t> m_breakpoints; +}; +} // namespace LibDebugger |
