Skip to content

Instantly share code, notes, and snippets.

@sdstrowes
Last active December 16, 2015 14:20
Show Gist options
  • Save sdstrowes/5447966 to your computer and use it in GitHub Desktop.
Save sdstrowes/5447966 to your computer and use it in GitHub Desktop.
sds@ubuntu:~/test$ cat spin.c
#include <unistd.h>
int main(void)
{
while (1) {
sleep(1);
}
return 0;
}
sds@ubuntu:~/test$
sds@ubuntu:~/test$
sds@ubuntu:~/test$ gcc -W -Wall -Wextra -g -o spin spin.c
sds@ubuntu:~/test$ ./spin
^Z
[1]+ Stopped ./spin
sds@ubuntu:~/test$ bg
[1]+ ./spin &
sds@ubuntu:~/test$ ps aux | grep spin
sds 5780 0.0 0.0 3872 368 pts/2 S 03:50 0:00 ./spin
sds 5782 0.0 0.0 7636 912 pts/2 S+ 03:50 0:00 grep --color=auto spin
sds@ubuntu:~/test$
sds@ubuntu:~/test$
sds@ubuntu:~/test$ gdb ./spin 5780
GNU gdb (GDB) 7.1-ubuntu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/sds/test/spin...done.
Attaching to program: /home/sds/test/spin, process 5780
Reading symbols from /lib/libc.so.6...Reading symbols from /usr/lib/debug/lib/libc-2.11.1.so...done.
done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib64/ld-linux-x86-64.so.2...Reading symbols from /usr/lib/debug/lib/ld-2.11.1.so...done.
done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
0x00007fcff7a9ebc0 in __nanosleep_nocancel () at ../sysdeps/unix/syscall-template.S:82
82 ../sysdeps/unix/syscall-template.S: No such file or directory.
in ../sysdeps/unix/syscall-template.S
(gdb) generate-core-file
Saved corefile core.5780
(gdb) quit
A debugging session is active.
Inferior 1 [process 5780] will be detached.
Quit anyway? (y or n) y
Detaching from program: /home/sds/test/spin, process 5780
sds@ubuntu:~/test$
sds@ubuntu:~/test$
sds@ubuntu:~/test$ gdb ./spin core.5780
GNU gdb (GDB) 7.1-ubuntu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/sds/test/spin...done.
[New Thread 5780]
Reading symbols from /lib64/ld-linux-x86-64.so.2...Reading symbols from /usr/lib/debug/lib/ld-2.11.1.so...done.
done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
Core was generated by `/home/sds/test/spin'.
#0 0x00007fcff7a9ebc0 in ?? ()
(gdb) bt
#0 0x00007fcff7a9ebc0 in ?? ()
#1 0x00007fcff7a9ea50 in ?? ()
#2 0x0000000000000000 in ?? ()
(gdb) quit
sds@ubuntu:~/test$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment