Skip to contentSkip to conversation

getting ebp from another process ?

DISCUSSION James Stevenson 1 participant 2 messages Sep 29, 2002 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

Hi

under linux is it possible to get ebp from another process without attaching a debugger to it ?

thanks
James

#2 lore raw
In reply to a message not in the archive
Quoted 7 lines
Quoted 3 lines

under linux is it possible to get ebp from another process without attaching a debugger to it ?

Depends on what you mean by attaching a debugger. If you just want avoid starting an external program like gdb, you can do it with ptrace:

Quoted 6 lines

struct user_regs_struct regs_struct;

ptrace(PTRACE_ATTACH, target_pid, NULL, NULL); waitpid(target_pid, NULL, WUNTRACED); ptrace(PTRACE_GETREGS, target_pid, NULL, &regs_struct); target_ebp = regs_struct.ebp;

yeah this is where the problem lies. because there is already another process using ptrace on the process i want the info from.

i will probably just end up modifiing the host kernel so i can get the values from /proc/<pid>/ebp