2

I have a server program, which doesn't have a very clean/graceful shutdown (not supposed to terminate in general). When tracing memory leaks, I run it under valgrind, but finally have to kill the process by a signal (^C). Generally I try to terminate the process when the ambiance is quiet but still then some threads might have been busy processing jobs and memory held by them cause false alarms. To assist such analysis, is there any way (tool) in valgrind, so that it can print the backtrace of threads when the program exits (by a signal?).

4

2 回答 2

1

我知道这很不方便,但是你能让你的程序在收到这个信号时转储核心,然后用 诊断核心转储gdb吗?

于 2009-12-22T02:52:50.450 回答
0

不确定我是否完全理解您的问题,但您可以通过 gdb 打印所有 pthread 的回溯:

thread apply all bt
于 2009-12-21T21:23:44.740 回答