We can take a peek into the process stack (technically, the stack of main()) in different ways. Here, we show two possibilities:
- Automatically via the gstack(1) utility
- Manually with the GDB debugger
Peek at the usermode stack, first, via gstack(1):
As a quick example, we look up the stack of bash (the parameter is the PID of the process):
$ gstack 14654#0 0x00007f3539ece7ea in waitpid () from /lib64/libc.so.6#1 0x000056474b4b41d9 in waitchld.isra ()#2 0x000056474b4b595d ...