I'm in the process of debugging a C program (that I didn't write). I have all of the internal debugging tools (a whole bunch of printf's) enabled, and I wrote a small PHP script that uses proc_open() and just grabs both stdout and stderr, and time-coordinates them in one file.
At the moment, the binary is dieing with a realloc() error that's caught by glibc, and a glibc backtrace is printed, beginning with:
*** glibc detected *** /sbin/rsyslogd: realloc(): invalid next size: 0x00002ace626ac910 ***
Here's the thing I don't understand: I've confirmed that the PHP script is catching both stdout and stderr from the binary's process and writing them to the correct files, but this backtrace is still printed to the console. Where is this coming from? Is there some magical output channel other than stdout and stderr?
Any ideas on how I go about capturing this backtrace to a file, or sending it out with stderr?
Thanks, Jason
Sorry... I asked the question after about half an hour of googling, but after a little more investigation, I found a solution... in a Fedora mailing list post (http://www.redhat.com/archives/rhl-devel-list/2009-August/msg00982.html) dealing with this problem in the Koji build system...
export LIBC_FATAL_STDERR_=1
Apparently by default the error reports go right to /dev/tty for some reason...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With