You are on page 1of 1

* Intro

gcc my_shell.c -o my_shell -g


gdb my_shell -s my_shell (load symbol table)
help

* Run
run

* Breakpoints (each breakpoint assigned has a number/identifier)


b 68 <line_number>
b isSeparatorPresent <function_name>
d (delete breakpoint)
info breakpoints
continue (continue running after breakpoint)
ignore 2 2 <ignore_breakpoint_2_for_2_crossings>
enable 2 <enable_breakpoint_number>
disable 2 <disable_breakpoint_number>

* Conditional breakpoints (2 ways)


b 68 if l==2
"OR"
b 68
condition 2 l==2 <condition_for_breakpoint_number>

* Step over line by line (next; nexti for instruction stepping)


n
n
...

* Step into the function call


step

* Continue till current stack frame returns


finish

* Print stack trace


backtrace

* Print array
print *cmd@2 <*array_name@length>

* Var details
info variables (global/local vars)
info locals (local vars)
info args (function args)
info frame (currently selected frame)

* Debug an already running process


attach <PID>

You might also like