glibc backtrace - 无法将输出重定向到文件 [英] glibc backtrace - can't redirect output to file
问题描述
目前,该二进制文件正在使用glibc捕获的realloc()错误,并打印了一个glibc回溯,以:开头:
*** glibc detected *** / sbin / rsyslogd:realloc():invalid next size:0x00002ace626ac910 ***
这是我不明白的事情:我已经确认PHP脚本从二进制文件的进程捕获了stdout和stderr,并将其写入正确的文件,但这个追溯仍然打印到控制台。这是从哪里来的?有没有一些神奇的输出渠道,除了stdout和stderr?
有关我如何去捕获这个回溯到一个文件或用stderr发送的任何想法? p>
谢谢,
Jason
对不起...我在大约半个小时的谷歌搜索后问了这个问题,但经过多一点调查,我在Fedora邮件列表中找到了一个解决方案( http://www.redhat.com/archives/rhl-devel-list/2009-August/msg00982.html )交易在Koji构建系统中出现这个问题...
export LIBC_FATAL_STDERR_ = 1
显然默认情况下,错误报告由于某种原因正确到/ dev / tty ...
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...
这篇关于glibc backtrace - 无法将输出重定向到文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!