summaryrefslogtreecommitdiffhomepage
path: root/dev/LibDebugger
diff options
context:
space:
mode:
Diffstat (limited to 'dev/LibDebugger')
-rw-r--r--dev/LibDebugger/CommonCLI.inl18
-rw-r--r--dev/LibDebugger/NeKernelContract.h4
-rw-r--r--dev/LibDebugger/POSIXMachContract.h2
-rw-r--r--dev/LibDebugger/src/NeKernelContract.cc34
-rw-r--r--dev/LibDebugger/src/NeKernelContractCLI.cc35
-rw-r--r--dev/LibDebugger/src/POSIXMachContractCLI.cc (renamed from dev/LibDebugger/src/POSIXMachContract.cc)21
6 files changed, 99 insertions, 15 deletions
diff --git a/dev/LibDebugger/CommonCLI.inl b/dev/LibDebugger/CommonCLI.inl
new file mode 100644
index 0000000..0660bb3
--- /dev/null
+++ b/dev/LibDebugger/CommonCLI.inl
@@ -0,0 +1,18 @@
+
+static BOOL kKeepRunning = false;
+
+#ifdef LD_NEKERNEL_DEBUGGER
+static LibDebugger::NeKernel::NeKernelContract kKernelDebugger;
+#else
+static LibDebugger::POSIX::POSIXMachContract kDebugger;
+#endif
+
+static LibDebugger::ProcessID kPID = 0L;
+static LibDebugger::CAddress kActiveAddress = nullptr;
+static std::string kPath = "";
+
+#define kBlank "\e[0;30m"
+#define kRed "\e[0;31m"
+#define kWhite "\e[0;97m"
+
+#define kStdOut (std::cout << kRed << "dbg: " << kWhite) \ No newline at end of file
diff --git a/dev/LibDebugger/NeKernelContract.h b/dev/LibDebugger/NeKernelContract.h
index 0245638..b63dcb9 100644
--- a/dev/LibDebugger/NeKernelContract.h
+++ b/dev/LibDebugger/NeKernelContract.h
@@ -6,6 +6,8 @@
#ifndef LD_NEKERNEL_CONTRACT_H
#define LD_NEKERNEL_CONTRACT_H
+#ifdef LD_NEKERNEL_DEBUGGER
+
#include <LibDebugger/DebuggerContract.h>
#include <sys/socket.h>
@@ -66,4 +68,6 @@ class NeKernelContract : public DebuggerContract {
};
} // namespace LibDebugger::NeKernel
+#endif // ifdef LD_NEKERNEL_DEBUGGER
+
#endif // LD_NEKERNEL_CONTRACT_H \ No newline at end of file
diff --git a/dev/LibDebugger/POSIXMachContract.h b/dev/LibDebugger/POSIXMachContract.h
index 5904cd2..1d7561a 100644
--- a/dev/LibDebugger/POSIXMachContract.h
+++ b/dev/LibDebugger/POSIXMachContract.h
@@ -4,7 +4,7 @@
#pragma once
-#ifdef __APPLE__
+#ifdef LD_MACH_DEBUGGER
/// @file POSIXMachContract.h
/// @brief POSIX Mach debugger.
diff --git a/dev/LibDebugger/src/NeKernelContract.cc b/dev/LibDebugger/src/NeKernelContract.cc
new file mode 100644
index 0000000..e653d12
--- /dev/null
+++ b/dev/LibDebugger/src/NeKernelContract.cc
@@ -0,0 +1,34 @@
+/***
+ LibDebugger
+ (C) 2025 Amlal El Mahrouss
+ File: NeKernelContract.cc
+ Purpose: NeKernel Debugger
+*/
+
+#ifdef LD_NEKERNEL_DEBUGGER
+
+#include <LibCompiler/Defines.h>
+#include <LibDebugger/NeKernelContract.h>
+#include <Vendor/Dialogs.h>
+
+#include <cstdint>
+#include <iostream>
+#include <string>
+
+using namespace LibDebugger::NeKernel;
+
+NeKernelContract::NeKernelContract() = default;
+
+NeKernelContract::~NeKernelContract() = default;
+
+bool NeKernelContract::Attach(std::string path, std::string argv, ProcessID& pid) noexcept { return false; }
+
+bool NeKernelContract::Breakpoint(std::string symbol) noexcept { return false; }
+
+bool NeKernelContract::Break() noexcept { return false; }
+
+bool NeKernelContract::Continue() noexcept { return false; }
+
+bool NeKernelContract::Detach() noexcept { return false; }
+
+#endif // LD_NEKERNEL_DEBUGGER \ No newline at end of file
diff --git a/dev/LibDebugger/src/NeKernelContractCLI.cc b/dev/LibDebugger/src/NeKernelContractCLI.cc
new file mode 100644
index 0000000..1f05ff2
--- /dev/null
+++ b/dev/LibDebugger/src/NeKernelContractCLI.cc
@@ -0,0 +1,35 @@
+/***
+ LibDebugger
+ (C) 2025 Amlal El Mahrouss
+ File: NeKernelContract.cc
+ Purpose: NeKernel Debugger CLI.
+*/
+
+#ifdef LD_NEKERNEL_DEBUGGER
+
+#include <LibCompiler/Defines.h>
+#include <LibDebugger/NeKernelContract.h>
+#include <Vendor/Dialogs.h>
+
+#include <cstdint>
+#include <iostream>
+#include <string>
+
+#include <LibDebugger/CommonCLI.inl>
+
+using namespace LibDebugger::NeKernel;
+
+LIBCOMPILER_MODULE(DebuggerNeKernel) {
+ pfd::notify("Debugger Event",
+ "Kernel Debugger\n(C) 2025 Amlal El Mahrouss, all rights reserved.");
+
+ if (argc >= 3 && std::string(argv[1]) == "-p" && argv[2] != nullptr) {
+ kPath = argv[2];
+ kStdOut << "[+] Kernel image set to: " << kPath << "\n";
+ }
+
+
+ return EXIT_SUCCESS;
+}
+
+#endif // LD_NEKERNEL_DEBUGGER \ No newline at end of file
diff --git a/dev/LibDebugger/src/POSIXMachContract.cc b/dev/LibDebugger/src/POSIXMachContractCLI.cc
index 2753e9a..90cebc3 100644
--- a/dev/LibDebugger/src/POSIXMachContract.cc
+++ b/dev/LibDebugger/src/POSIXMachContractCLI.cc
@@ -1,8 +1,11 @@
/***
+ LibDebugger
(C) 2025 Amlal El Mahrouss
- */
+ File: POSIXMachContract.cc
+ Purpose: OS X/Darwin Debugger
+*/
-#ifdef __APPLE__
+#ifdef LD_MACH_DEBUGGER
#include <LibCompiler/Defines.h>
#include <LibDebugger/POSIXMachContract.h>
@@ -11,17 +14,7 @@
#include <iostream>
#include <string>
-static BOOL kKeepRunning = false;
-static LibDebugger::POSIX::POSIXMachContract kDebugger;
-static LibDebugger::ProcessID kPID = 0L;
-static LibDebugger::CAddress kActiveAddress = nullptr;
-static std::string kPath = "";
-
-#define kBlank "\e[0;30m"
-#define kRed "\e[0;31m"
-#define kWhite "\e[0;97m"
-
-#define kStdOut (std::cout << kRed << "dbg: " << kWhite)
+#include <LibDebugger/CommonCLI.inl>
/// @internal
/// @brief Handles CTRL-C signal on debugger.
@@ -47,7 +40,7 @@ LIBCOMPILER_MODULE(DebuggerMachPOSIX) {
kPath = argv[2];
kDebugger.SetPath(kPath);
- kStdOut << "[+] Path set to: " << kPath << "\n";
+ kStdOut << "[+] Image set to: " << kPath << "\n";
}
::signal(SIGINT, dbgi_ctrlc_handler);