Reputation: 107
I want to view the stack of a particular process in linux. It could be any process. I know that GDB could help, but I guess you need the source code to analyse the output.
Upvotes: 1
Views: 873
Reputation: 90463
The only way to do it is with either a debugger or the debugging API (ptrace
for linux).
Basically what you want to do is:
PTRACE_ATTACH
)PTRACE_GETREGS
)esp
or rsp
)PTRACE_PEEKDATA
or /proc/<pid>/mem
)PTRACT_DETACH
)From there, the analysis is pretty much up to you. You may want to check out my debugger edb. For more details, of course you should man ptrace
Upvotes: 2