GDB报告崩溃,但程序运行正常

时间:2013-02-14 16:26:54

标签: c++ linux gdb

我有一个程序,当我从终端(没有GDB)运行时打印一些输出。假设输出看起来像

welcome to CMP simulator
initializing
finish initialization
now run
goodbye

现在,当我想使用GDB时,程序会给出一个PID,我用它来附加到GDB。假设程序的输出现在看起来像

welcome to CMP simulator
gdb - 5932    (Run this command on another terminal and type "continue" at GDB prompt)

当程序等待SIGCONT时,我在另一个终端上运行gdb - 5932。当我输入“continue”时,GDB会报告这样的崩溃:

Loaded symbols for /home/mahmood/results/temp/libCMP_iface_gcc.so
0x00007fd3a499fb7b in raise (sig=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/pt-raise.c:42
42      ../nptl/sysdeps/unix/sysv/linux/pt-raise.c: No such file or directory.
(gdb) c
Continuing.

Program received signal SIGSTOP, Stopped (signal).
[Switching to Thread 0x7fd3a343f700 (LWP 21014)]
0x00007fd3a408e303 in __GI___poll (fds=<optimized out>, nfds=<optimized out>, timeout=<optimized out>)
     at ../sysdeps/unix/sysv/linux/poll.c:87
87      ../sysdeps/unix/sysv/linux/poll.c: No such file or directory.
(gdb) bt
#0  0x00007fd3a408e303 in __GI___poll (fds=<optimized out>, nfds=<optimized out>, timeout=<optimized out>)
     at ../sysdeps/unix/sysv/linux/poll.c:87
#1  0x00007fd3a4c0fc4c in ?? () from /home/mahmood/simics-3.0.31/amd64-linux/bin/libsimics-common.so
#2  0x00007fd3a4997e9a in start_thread (arg=0x7fd3a343f700) at pthread_create.c:308
#3  0x00007fd3a4099cbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#4  0x0000000000000000 in ?? ()
(gdb)

此时,程序仍在等待SIGCONT。

后跟踪是什么意思? 如您所见,没有GDB,程序会在输出上打印更多行。然而,GDB显示崩溃。我的猜测是创建线程有问题。

感谢任何反馈。

更新:

如果我再次运行“继续”,我会在GDB上看到相同的输出

 (gdb) c
 Continuing.

 Program received signal SIGSTOP, Stopped (signal).
 0x00007f09b653c303 in __GI___poll (fds=<optimized out>, nfds=<optimized out>,  timeout=      <optimized out>)
    at ../sysdeps/unix/sysv/linux/poll.c:87
 87      in ../sysdeps/unix/sysv/linux/poll.c
 (gdb) bt
 #0  0x00007f09b653c303 in __GI___poll (fds=<optimized out>, nfds=<optimized out>, timeout=<optimized out>)
     at ../sysdeps/unix/sysv/linux/poll.c:87
 #1  0x00007f09b70bdc4c in ?? () from /home/mahmood/simics-3.0.31/amd64-linux/bin/libsimics-common.so
 #2  0x00007f09b6e45e9a in start_thread (arg=0x7f09b58ed700) at pthread_create.c:308
 #3  0x00007f09b6547cbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
 #4  0x0000000000000000 in ?? ()
 (gdb)

系统是ubuntu 12.04 amd64

2 个答案:

答案 0 :(得分:0)

GDB没有显示崩溃,SIGSTOP只是意味着程序已经停止,你只需要使用gdb命令'continue'继续它,或者只是要求GDB使用'sig SIGCONT'发送信号

我希望我帮助你。

答案 1 :(得分:0)

  

pt-raise.c:没有这样的文件或目录

可以通过从源

重建gdb来修复此错误