34. C interpreter
1. $ gdb `which gdb`
2. (gdb) start
3. Enjoy your world…
• Example:
(gdb) p 1 + 2 + abs(-‐3)
(gdb) p strcmp("VIVOTEK", "AXIS")
(gdb) x/s getenv(“HOME”)
(gdb) p (char*)getenv("HOME")
(gdb) p (char)*getenv("HOME")
(gdb) p printf("%dn", 12345678)
35. Signal Handler
Terminal hang / Reboot PC
You have to close terminal (e.g., PuTTY, iTerm,...)
Conventional solution
(gdb) handle SIGHUP
GNU Screen / Tmux Signal Stop Print Pass to program Description
SIGHUP Yes Yes Yes Hangup
(gdb) handle SIGHUP nopass
Signal Stop Print Pass to program Description
nohup SIGHUP Yes Yes No Hangup
Program received signal SIGHUP, Hangup.
GDB solution 0x0000003ac7a954e0 in __nanosleep_nocancel () from /lib64/libc.so.6
(gdb)
Continuing.
$ gdb [program] [pid]
(gdb) handle SIGHUP nopass
(gdb) continue