search for gdb(1) to use gdb-based backtrace

In addition:

- set `debug_mode` if the environment variable, `XDEBUG` is defined.
- add some local variables in the sample program.