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