summaryrefslogtreecommitdiff
path: root/Applications/Debugger
diff options
context:
space:
mode:
authorItamar <itamar8910@gmail.com>2020-04-04 11:26:56 +0300
committerAndreas Kling <kling@serenityos.org>2020-04-13 00:53:22 +0200
commit984ff93406e79df67060e0d87d04eb9d40242697 (patch)
tree2e306aa0596e48e888ae327a7e81706703ec782b /Applications/Debugger
parent77f671b462be1c3f5469a348337326235da6d5a0 (diff)
downloadserenity-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.cpp10
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, &regs, 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");