在 bash 中捕获线程转储
Capture thread dump in bash
我的命令失败了,我认为是线程转储或其他东西。由于我想检查,我想将输出重定向到文件或更少。但是输出似乎不在标准或标准输出上?!如何捕获此输出?
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。有相同问题的人的博客文章。我知道如何解决这个问题,但为什么我无法捕获错误产生的输出感到困惑。
这可能是glibc产生输出,例如当你有double-free((s时。 设置以下环境变量可能会有所帮助: LIBC_FATAL_STDERR_=1
(然后输出将在 STDERR 中。
但是,对于您粘贴的输出,这也可能是内核输出,它独立于您的程序发生。
相关文章:
- 分段故障(堆芯转储)矢量
- 从不同线程使用int64的不同字节安全吗
- 删除一个线程上有数百万个字符串的大型哈希映射会影响另一个线程的性能
- 在C++中使用cURL和多线程
- Cppcheck生成xml转储文件
- 在 bash 中捕获线程转储
- C++ std 线程并列出分段错误(核心转储)
- v8 多线程储物柜
- 所有线程都在核心转储文件中等待,但有人触发了SIG_ABRT
- 将线程的结果转储到向量中是线程安全的吗
- 从内存转储中查找线程消息队列中的消息
- 多线程-一个作家和一个读者-我们需要使用储物柜吗
- 转储关键节队列(线程正在等待)
- C++分段错误(核心转储)错误 - 强制转换指针/将函数值返回到线程
- c++中多线程中的分段错误(核心转储)
- 在Windows迷你转储文件中嵌入线程名称
- 多线程程序中的核心转储:basic_string::_S_construct null无效
- 使用 C++11 线程的分段错误(核心转储)
- 将读取线分段故障(堆芯转储)到阵列中
- 在使用boost线程的多线程中出现分段错误(核心转储)