diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-11-18 08:48:32 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-18 08:48:32 +0100 |
| commit | 4a0e2c718ffafa56d188a637b9180e2b2408101e (patch) | |
| tree | 67a467f00496bbd544c00f8d0dfcc98fe4c230d2 /dev/DebuggerKit | |
| parent | 903b913503630d12a6b3b71a0be28b48b1b9f3d5 (diff) | |
| parent | e2bb97abab728e8af5ee4a55cbf838e77c61dfb1 (diff) | |
Merge pull request #20 from nekernel-org/dev
License and name fixes.
Diffstat (limited to 'dev/DebuggerKit')
| -rw-r--r-- | dev/DebuggerKit/CommonCLI.inl | 6 | ||||
| -rw-r--r-- | dev/DebuggerKit/NeKernelContract.h | 6 | ||||
| -rw-r--r-- | dev/DebuggerKit/POSIXMachContract.h | 11 |
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 |
