summaryrefslogtreecommitdiffhomepage
path: root/dev/LibDebugger
diff options
context:
space:
mode:
authorAmlal <amlal.elmahrouss@icloud.com>2025-01-28 13:05:45 +0100
committerAmlal <amlal.elmahrouss@icloud.com>2025-01-28 13:05:45 +0100
commitb250f99aad1014b57e1eee5831d6485488477bcb (patch)
treefc8cf518d30748db636aedbc5c77f1cc1637ec5a /dev/LibDebugger
parent8aa2adf99fd4fcc4b47c534d2fed5ec7ed6ea334 (diff)
FIX: Don't exit program when errno is set.
Signed-off-by: Amlal <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/LibDebugger')
-rw-r--r--dev/LibDebugger/Debugger.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/dev/LibDebugger/Debugger.h b/dev/LibDebugger/Debugger.h
index af3217c..9129839 100644
--- a/dev/LibDebugger/Debugger.h
+++ b/dev/LibDebugger/Debugger.h
@@ -14,7 +14,7 @@
namespace LibDebugger
{
- /// \brief Debug IDebugger class in C++
+ /// \brief Debugger interface class in C++
/// \author Amlal El Mahrouss
class IDebugger final
{
@@ -33,7 +33,7 @@ namespace LibDebugger
if (ptrace(PTRACE_ATTACH, this->m_pid, nullptr, nullptr) == -1)
{
perror("dbg: Attach");
- exit(1);
+ return;
}
waitpid(m_pid, nullptr, 0);
@@ -47,14 +47,14 @@ namespace LibDebugger
if (original_data == -1)
{
perror("dbg: Peek");
- exit(1);
+ return;
}
long data_with_int3 = (original_data & ~0xFF) | 0xCC; // Insert INT3 (0xCC)
if (ptrace(PTRACE_POKETEXT, m_pid, addr, data_with_int3) == -1)
{
perror("dbg: Poke");
- exit(1);
+ return;
}
std::cout << "[+] Breakpoint set at: " << addr << std::endl;
@@ -67,7 +67,7 @@ namespace LibDebugger
if (ptrace(PTRACE_CONT, m_pid, nullptr, nullptr) == -1)
{
perror("dbg: Cont");
- exit(1);
+ return;
}
int status;
@@ -84,7 +84,7 @@ namespace LibDebugger
if (ptrace(PTRACE_DETACH, m_pid, nullptr, nullptr) == -1)
{
perror("dbg: Detach");
- exit(1);
+ return;
}
std::cout << "[-] Detached from process: " << m_pid << std::endl;