namecoin / sockstrace

Go port of Heteronculous (ptrace-based proxy leak detector). Outreachy project.
https://www.namecoin.org/
GNU General Public License v3.0
7 stars 3 forks source link

Dump stack trace of tracee #63

Open JeremyRand opened 1 year ago

JeremyRand commented 1 year ago

Dumping the stack trace of the tracee when a leak is detected would be useful for debugging where the leak happened.

For bonus points, support dumping the stack trace of non-C languages too (e.g. I believe Python and Go have straightforward ways to dump a stack trace).

JeremyRand commented 1 year ago

This is akin to the -k flag in C strace.

sporksmith commented 1 year ago

One relatively easy way to implement this is to send SIGABRT to the traced program; it should generate a core dump, which can then be loaded into gdb where the stack and other state can be inspected. (IIRC sending the signal natively will result in a ptrace stop, which will need to be handled to actually deliver the signal). Core dumps will also need to have been enabled by the user (e.g. ulimit -c unlimited)

This is of course fairly heavy-handed and not the best user experience.

robertmin1 commented 1 year ago

Nice, I can implement both and make it configurable