summaryrefslogtreecommitdiffhomepage
path: root/src/DebuggerKit/DebuggerContract.h
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-11-24 03:05:29 +0100
committerAmlal El Mahrouss <amlal@nekernel.org>2025-11-24 03:05:29 +0100
commitbbe2c77243c541ca7e0075149f5be3262eb89523 (patch)
treeae5d59d299344fd19584a2c3642bacd788e841d4 /src/DebuggerKit/DebuggerContract.h
parentb5adf16a96b9cbb80c74cf30404ed5bcff03ac34 (diff)
feat! breaking changes on necti sources.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'src/DebuggerKit/DebuggerContract.h')
-rw-r--r--src/DebuggerKit/DebuggerContract.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/DebuggerKit/DebuggerContract.h b/src/DebuggerKit/DebuggerContract.h
new file mode 100644
index 0000000..2114041
--- /dev/null
+++ b/src/DebuggerKit/DebuggerContract.h
@@ -0,0 +1,52 @@
+/* ========================================
+
+ Copyright (C) 2025 Amlal El Mahrouss, Licensed under the Apache 2.0 license.
+
+======================================== */
+
+#pragma once
+
+#include <DebuggerKit/Platform.h>
+
+#define DK_DEBUGGER_CONTRACT : public ::DebuggerKit::DebuggerContract
+
+namespace DebuggerKit {
+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 BreakAt(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{(ProcessID)~0};
+ std::unordered_map<uintptr_t, uintptr_t> m_breakpoints;
+};
+} // namespace DebuggerKit