glibc backtrace - can't redirect output to file

Posted by Jason Antman on Stack Overflow See other posts from Stack Overflow or by Jason Antman
Published on 2011-01-06T14:38:39Z Indexed on 2011/01/06 14:53 UTC
Read the original article Hit count: 328

Filed under:
|

Hi,

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

© Stack Overflow or respective owner

Related posts about debugging

Related posts about glibc