summaryrefslogtreecommitdiffhomepage
path: root/dev/DebuggerKit
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-11-18 06:42:53 +0100
committerAmlal El Mahrouss <amlal@nekernel.org>2025-11-18 06:42:53 +0100
commita3887b0695ffc83d2541d2ad8124e0d02f45ceae (patch)
tree8ecc0e38c845a85d3d9fb77a3aa81369f7837734 /dev/DebuggerKit
parent233d0343265ccda26ad06bfe52acdb1d12489bf4 (diff)
fix: meta: codebase improvements.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/DebuggerKit')
-rw-r--r--dev/DebuggerKit/CommonCLI.inl6
-rw-r--r--dev/DebuggerKit/NeKernelContract.h6
-rw-r--r--dev/DebuggerKit/POSIXMachContract.h11
3 files changed, 10 insertions, 13 deletions
diff --git a/dev/DebuggerKit/CommonCLI.inl b/dev/DebuggerKit/CommonCLI.inl
index eb56257..a4f13ca 100644
--- a/dev/DebuggerKit/CommonCLI.inl
+++ b/dev/DebuggerKit/CommonCLI.inl
@@ -5,10 +5,6 @@
Purpose: Common Debugger symbols.
*/
-#include <cstdint>
-#include <iostream>
-#include <string>
-
#define kBlank "\e[0;30m"
#define kRed "\e[0;31m"
#define kWhite "\e[0;97m"
@@ -25,4 +21,4 @@ static DebuggerKit::POSIX::POSIXMachContract kDebugger;
static DebuggerKit::ProcessID kPID = 0L;
static DebuggerKit::CAddress kActiveAddress = nullptr;
-static std::string kPath = "";
+static CompilerKit::STLString kPath = "";
diff --git a/dev/DebuggerKit/NeKernelContract.h b/dev/DebuggerKit/NeKernelContract.h
index f0da828..3a1fbad 100644
--- a/dev/DebuggerKit/NeKernelContract.h
+++ b/dev/DebuggerKit/NeKernelContract.h
@@ -27,7 +27,7 @@ namespace Detail {
typedef int64_t dk_socket_type;
} // namespace Detail
-class NeKernelContract DK_DEBUGGER_CONTRACT {
+class NeKernelContract final DK_DEBUGGER_CONTRACT {
public:
NeKernelContract();
virtual ~NeKernelContract() override;
@@ -37,8 +37,8 @@ class NeKernelContract DK_DEBUGGER_CONTRACT {
NeKernelContract(const NeKernelContract&) = default;
public:
- bool Attach(std::string path, std::string arg_v, ProcessID& pid) noexcept override;
- bool BreakAt(std::string symbol) noexcept override;
+ bool Attach(CompilerKit::STLString path, CompilerKit::STLString arg_v, ProcessID& pid) noexcept override;
+ bool BreakAt(CompilerKit::STLString symbol) noexcept override;
bool Break() noexcept override;
bool Continue() noexcept override;
bool Detach() noexcept override;
diff --git a/dev/DebuggerKit/POSIXMachContract.h b/dev/DebuggerKit/POSIXMachContract.h
index 1864aff..2df6ef1 100644
--- a/dev/DebuggerKit/POSIXMachContract.h
+++ b/dev/DebuggerKit/POSIXMachContract.h
@@ -44,7 +44,7 @@ CK_IMPORT_C kern_return_t mach_vm_protect(vm_map_t target_task, mach_vm_address_
namespace DebuggerKit::POSIX {
/// \brief POSIXMachContract engine interface class in C++
/// \author Amlal El Mahrouss
-class POSIXMachContract : public DebuggerContract {
+class POSIXMachContract final DK_DEBUGGER_CONTRACT {
public:
explicit POSIXMachContract() = default;
~POSIXMachContract() override = default;
@@ -54,7 +54,7 @@ class POSIXMachContract : public DebuggerContract {
POSIXMachContract(const POSIXMachContract&) = default;
public:
- Bool Attach(std::string path, std::string argv, ProcessID& pid) noexcept override {
+ Bool Attach(CompilerKit::STLString path, CompilerKit::STLString argv, ProcessID& pid) noexcept override {
pid = fork();
if (pid == 0) {
@@ -82,7 +82,7 @@ class POSIXMachContract : public DebuggerContract {
return true;
}
- void SetPath(std::string path) noexcept {
+ void SetPath(CompilerKit::STLString path) noexcept {
if (path.empty()) {
return;
}
@@ -90,7 +90,7 @@ class POSIXMachContract : public DebuggerContract {
m_path = path;
}
- Bool BreakAt(std::string symbol) noexcept override {
+ Bool BreakAt(CompilerKit::STLString 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);
@@ -112,6 +112,7 @@ class POSIXMachContract : public DebuggerContract {
mach_vm_protect(task, (mach_vm_address_t) addr, sizeof(uint32_t), false,
VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE);
+
mach_vm_write(task, (mach_vm_address_t) addr, (vm_offset_t) &brk_inst, sizeof(addr));
return true;
@@ -151,7 +152,7 @@ class POSIXMachContract : public DebuggerContract {
private:
ProcessID m_pid{0};
- std::string m_path;
+ CompilerKit::STLString m_path;
};
} // namespace DebuggerKit::POSIX