我的命令失败了,我认为是一个线程转储或其他东西。由于我想检查,我想将输出重定向到一个或更少的文件。然而,输出似乎不是stderr或stdout?!如何捕获此输出?
7f47efcda000-7f47efcdb000 r--p 00000000 fc:00 174138 /usr/lib/libgtest_main.so.0.0.0
7f47efcdb000-7f47efcdc000 rw-p 00001000 fc:00 174138 /usr/lib/libgtest_main.so.0.0.0
7f47efcdc000-7f47efd25000 r-xp 00000000 fc:00 174141 /usr/lib/libgtest.so.0.0.0
7f47efd25000-7f47eff25000 ---p 00049000 fc:00 174141 /usr/lib/libgtest.so.0.0.0
7f47eff25000-7f47eff26000 r--p 00049000 fc:00 174141 /usr/lib/libgtest.so.0.0.0
7f47eff26000-7f47eff27000 rw-p 0004a000 fc:00 174141 /usr/lib/libgtest.so.0.0.0
7f47eff27000-7f47eff28000 rw-p 00000000 00:00 0
7f47eff28000-7f47eff4e000 r-xp 00000000 fc:00 899 /lib/x86_64-linux-gnu/ld-2.23.so
7f47f00c6000-7f47f00e2000 rw-p 00000000 00:00 0
7f47f00e2000-7f47f0100000 r-xp 00000000 fc:00 422 /lib/x86_64-linux-gnu/libudev.so.1.6.4
7f47f0100000-7f47f0101000 r--p 0001d000 fc:00 422 /lib/x86_64-linux-gnu/libudev.so.1.6.4
7f47f0101000-7f47f0102000 rw-p 0001e000 fc:00 422 /lib/x86_64-linux-gnu/libudev.so.1.6.4
7f47f0102000-7f47f0132000 rw-p 00000000 00:00 0
7f47f014c000-7f47f014d000 rw-p 00000000 00:00 0
7f47f014d000-7f47f014e000 r--p 00025000 fc:00 899 /lib/x86_64-linux-gnu/ld-2.23.so
7f47f014e000-7f47f014f000 rw-p 00026000 fc:00 899 /lib/x86_64-linux-gnu/ld-2.23.so
7f47f014f000-7f47f0150000 rw-p 00000000 00:00 0
7ffca7f25000-7ffca7f46000 rw-p 00000000 00:00 0 [stack]
7ffca7f84000-7ffca7f86000 r--p 00000000 00:00 0 [vvar]
7ffca7f86000-7ffca7f88000 r-xp 00000000 00:00 0 [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
2/2 Test #2: subscriberSkeleton_gtest .........***Exception: Other 0.03 sec
0% tests passed, 2 tests failed out of 2
Total Test time (real) = 0.07 sec
我尝试了make test 2> file
,make test 2>&1 | less
的变体,这些仅输出最后一行,而不是转储。
有问题的代码就是这样:
#include <gtest/gtest.h>
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
使该程序失败的问题是它与OpenCV链接在一起,OpenCV包含与GTest冲突的测试组件opencv_ts。 Blog post有同样问题的人。我知道如何解决这个问题,但我很难理解为什么我无法捕获错误产生的输出。
答案 0 :(得分:2)
这可能是glibc产生输出,例如当你有double-free()时。设置以下环境变量可能会有所帮助:binding.irb
(输出将在STDERR中。)
但是,对于您粘贴的输出,这也可能是内核输出,它独立于您的程序。