上一篇说过,GDB使用的时候表现很奇怪,
线程都看不到,只能看到主线程,打其他线程的断点,都失效。
刚刚把源码也放到目录下,断点是打到了,但是同时程序也退出了。
提示信息如下:
Program terminated with signal SIGTRAP, Trace/breakpoint trap.
百度之后,发现GDB WIKI里有一个问题描述很类似。
http://sourceware.org/gdb/wiki/FAQ#GDB_does_not_see_any_threads_besides_the_one_in_which_crash_occurred.3B_or_SIGTRAP_kills_my_program_when_I_set_a_breakpoint.
<span style="font-size:18px;">GDB does not see any threads besides the one in which crash occurred;
or SIGTRAP kills my program when I set a breakpoint.</span>
This frequently happen on Linux, especially on embedded targets. There are two common causes:
(1) you are using glibc, and you have stripped libpthread.so.0
(2) mismatch between libpthread.so.0 and libthread_db.so.1
GDB itself does not know how to decode "