Previous Lecture | lect07 | Next Lecture |
Code from lecture
https://github.com/ucsb-cs24-w19-mirza/cs24-w19-lectures/tree/master/lec-07
gdb
- Demo of gdb commands
- To use gdb, compile with the -g flag
- Setting breakpoints (b)
- Running programs that take arguments within gdb (r arguments)
- Continue execution until breakpoint is reached (c)
- Stepping into functions with step (s)
- Stepping over functions with next (n)
- Re-running a program (r)
- Examining local variables (info locals)
- Printing the value of variables with print (p)
- Quitting gdb (q)
- Debugging segfaults with backtrace (bt)
- Refer to the gdb cheat sheet (handout given in class). More practice in lab 03.