diff options
author | Itamar <itamar8910@gmail.com> | 2020-04-04 11:26:56 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-04-13 00:53:22 +0200 |
commit | 984ff93406e79df67060e0d87d04eb9d40242697 (patch) | |
tree | 2e306aa0596e48e888ae327a7e81706703ec782b /Applications/Debugger | |
parent | 77f671b462be1c3f5469a348337326235da6d5a0 (diff) | |
download | serenity-984ff93406e79df67060e0d87d04eb9d40242697.zip |
ptrace: Add PT_PEEK
PT_PEEK reads a single word from the tracee's address space and returns
it to the tracer.
Diffstat (limited to 'Applications/Debugger')
-rw-r--r-- | Applications/Debugger/main.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Applications/Debugger/main.cpp b/Applications/Debugger/main.cpp index fd76270957..dae194388f 100644 --- a/Applications/Debugger/main.cpp +++ b/Applications/Debugger/main.cpp @@ -108,9 +108,17 @@ int main(int argc, char** argv) return 1; } + PtraceRegisters regs; + if (ptrace(PT_GETREGS, g_pid, ®s, 0) == -1) { + perror("getregs"); + return 1; + } + printf("hit breakpoint\n"); + printf("eip:0x%x\n", regs.eip); - sleep(1); + uint32_t data = ptrace(PT_PEEK, g_pid, (void*)regs.eip, 0); + printf("data: 0x%x\n", data); if (ptrace(PT_CONTINUE, g_pid, 0, 0) == -1) { perror("continue"); |