3
votes

I have a program that when I run from terminal (wihtout GDB) prints some outputs. Assume the output looks like

welcome to CMP simulator
initializing
finish initialization
now run
goodbye

Now, when I want to use GDB, the program gives a PID and I use that to attach to GDB. Assume the output of the program now looks like

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

While the program waits for SIGCONT, I run gdb - 5932 on anther terminal. As I type "continue", GDB reports a crash like this:

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)

At this point, the program still is waiting for SIGCONT.

What does the back trace means? As you can see without GDB, the program prints more line on the output. However GDB shows a crash. My guess is that there is a problem with creating thread.

Any feedback is appreciated.

UPDATE:

If I ran "continue" again, I see the same output on 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)

The system is ubuntu 12.04 amd64

2
It doesn't show a crash, it shows a signal - which may be perfectly find for your application. SIGSTOP is what happens if a program is stopped with CTRL-Z, but can be done in other ways as well. - Mats Petersson
I have to say that on another machine there is no problem and gdb successfully send SIGCONT. So additional outputs of the program can bee seen. Why it doesn't continue now? - mahmood
Try another continue. It's probably some sort of race condition, or some such - without knowing exactly what machines you are using, etc, it's quite hard to say. But just to be clear, it's a signal, but it's not a crash! - Mats Petersson
When SIGSTOP or SIGTSTP is sent to a process, the usual behaviour is to pause that process in its current state. The process will only resume execution if it is sent the SIGCONT signal. SIGSTOP and SIGCONT are used for job control in the Unix shell, among other purposes - Satish

2 Answers

0
votes

GDB isn't showing a crash, a SIGSTOP just means the program wasa stopped and you just have to continue it using gdb command 'continue' or just asking to GDB to send the signal using 'sig SIGCONT'

I hope I help you.

0
votes

pt-raise.c: No such file or directory

This error can be fixed by rebuilding gdb from sources