From b250f99aad1014b57e1eee5831d6485488477bcb Mon Sep 17 00:00:00 2001 From: Amlal Date: Tue, 28 Jan 2025 13:05:45 +0100 Subject: FIX: Don't exit program when errno is set. Signed-off-by: Amlal --- dev/LibDebugger/Debugger.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'dev/LibDebugger/Debugger.h') 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; -- cgit v1.2.3