3

我有一个程序,当我从终端(没有 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在另一个终端上运行。当我输入“继续”时,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

4

2 回答 2

0

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

我希望我能帮助你。

于 2013-02-20T13:09:12.420 回答
0

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

可以通过从源重建 gdb 来修复此错误

于 2016-10-30T12:45:26.453 回答