如何禁用 gdb 中的新线程/线程退出消息?
Posted
技术标签:
【中文标题】如何禁用 gdb 中的新线程/线程退出消息?【英文标题】:How can I disable new thread/thread exited messages in gdb? 【发布时间】:2012-06-11 19:56:22 【问题描述】:我正在调试一个应用程序,我收到很多这样的消息:
[New Thread 0x7fffde152700 (LWP 11142)]
[Thread 0x7fffde152700 (LWP 11142) exited]
[New Thread 0x7fff967fa700 (LWP 11143)]
[Thread 0x7fff967fa700 (LWP 11143) exited]
[New Thread 0x7fff967fa700 (LWP 11144)]
[Thread 0x7fff967fa700 (LWP 11144) exited]
[New Thread 0x7fff967fa700 (LWP 11145)]
[Thread 0x7fff967fa700 (LWP 11145) exited]
[New Thread 0x7fffde152700 (LWP 11146)]
[Thread 0x7fffde152700 (LWP 11146) exited]
[New Thread 0x7fffde152700 (LWP 11147)]
[Thread 0x7fffde152700 (LWP 11147) exited]
[New Thread 0x7fffde152700 (LWP 11148)]
[Thread 0x7fffde152700 (LWP 11148) exited]
[New Thread 0x7fffde152700 (LWP 11149)]
[Thread 0x7fffde152700 (LWP 11149) exited]
[New Thread 0x7fffde152700 (LWP 11150)]
[Thread 0x7fffde152700 (LWP 11150) exited]
[New Thread 0x7fffde152700 (LWP 11151)]
[Thread 0x7fffde152700 (LWP 11151) exited]
[New Thread 0x7fffde152700 (LWP 11152)]
[Thread 0x7fffde152700 (LWP 11152) exited]
[New Thread 0x7fffde152700 (LWP 11153)]
[Thread 0x7fffde152700 (LWP 11153) exited]
[New Thread 0x7fffde152700 (LWP 11154)]
[Thread 0x7fffde152700 (LWP 11154) exited]
[New Thread 0x7fff967fa700 (LWP 11155)]
[Thread 0x7fff967fa700 (LWP 11155) exited]
[New Thread 0x7fffde152700 (LWP 11156)]
[Thread 0x7fffde152700 (LWP 11156) exited]
[New Thread 0x7fffde152700 (LWP 11157)]
[Thread 0x7fffde152700 (LWP 11157) exited]
我几乎从不对此消息感兴趣。它们使阅读其余输出变得更加困难。它们可以改变程序的计时行为,从而难以重现和调试竞态危害。如何禁用这些消息?
【问题讨论】:
【参考方案1】:您可以在运行 gdb 时关闭线程事件:
set print thread-events off
【讨论】:
提示:将此添加到 ~/.gdbinit 以使其在每个 gdb 会话中自动发生。以上是关于如何禁用 gdb 中的新线程/线程退出消息?的主要内容,如果未能解决你的问题,请参考以下文章