The TUI mode represents a nice curses interface to gdb.
Compile your programs with:
gcc -ggdb
clang -gdwarf
nasm -g -F dwarf -felf64 prog.s
ld -o prog prog.o
Then issue the command: gdb prog
gdb
Then inside of GDB issue the following commands:
tui enable tui reg general break _start run [<params>]
Then use 'step', 'next', 'si', 'ni', etc as normal, but enjoy the curses window. The source window should be the selected one, which will respond to arrow keys and scroll wheel events to move around. The enter key will repeat the last command run over and over.
To direct the output of the program to a different terminal window (because you will not see the output because of the curses nature of the tui window,) use "tty" in the terminal you want to direct the output to, then in the gdb window use "tty ", such as "tty /dev/pts/4" for example, then "run" the program (re-run it if using debug.)
gdb program
-p pid - Debug the already running program with PID 'pid' -c core - Use the core file as the processes memory.
-p
-c
Use:
unlimit coredump (tcsh) ulimit -c unlimited (bash)
unlimit coredump
ulimit -c unlimited
to enable core-dumps.
run
c
next
step
list
:
break
catch
watch
awatch
print
where/bt
up
down
help
quit
info registers
i r
info frame
i f
print $reg
p $reg
print *(char **)($rsp+8)
display /3i $pc
ni
si
x /8g $rsp