From 199195c6c5b05855b6e7201591b23e401eb8766d Mon Sep 17 00:00:00 2001 From: YANNIS Date: Thu, 29 May 2025 20:01:32 +0200 Subject: [PATCH] =?UTF-8?q?ajout=20d'affichage=20de=20pc=20(non=20pars?= =?UTF-8?q?=C3=A9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Debugger.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Debugger.cpp b/Debugger.cpp index 9bcb480..71a89d5 100644 --- a/Debugger.cpp +++ b/Debugger.cpp @@ -7,6 +7,9 @@ #include #include #include +#include +#include +#include Debugger::Debugger(const std::string &prog_name) : program_name(prog_name) { std::cout << "[+] Debugger initialized for program: " << program_name << "\n"; @@ -76,6 +79,17 @@ uint32_t Debugger::get_opcode(void){ perror("ptrace(PTRACE_GETREGSET)"); return 0; } + std::cout << "[+] Current PC(HEX): " << std::hex << regs.pc << std::dec << "\n"; + std::cout << "[+] Current PC(BIN): "; + std::cout << "[+] regs.pc (big-endian, 8-bit chunks): "; + for (int i = 56; i >= 0; i -= 8) { + uint8_t byte = (regs.pc >> i) & 0xFF; + for (int j = 7; j >= 0; --j) { + std::cout << ((byte >> j) & 1); + } + std::cout << " "; + } + std::cout << std::endl; return ptrace(PTRACE_PEEKTEXT, child_pid, regs.pc, nullptr); }