C - Debugging Tools Flashcards
- breakpoint
a point in the program where it will stop executing
- Watchpoint
a point where the program will stop executing when the specified memory location is modified
- catchpoint
special breakpoint that stops program execution when a certian kind of event occurs
- memory leak
a program error of repeatedly allocating memory, using it, and neglecting to free it
- valgrind
programming tool for memory debugging, memory leak detection, and profiling.
commands 1: run
run [arglist]
start your program (with arglist, if specified).
basic commands 2. continue
c
continue running your program (after stopping, like at a breakpoint)
basic commands 3. finish
finish
continue execution until the current function returns
basic commands 4. break
break [[ func | line | *addr)}] [if cond] [thread thread]
sets a breakpoint at a specified location.
break 200 // sets breakpoint at 200
basic commands 5. next
next [expr]
executes the next function call, and stops when the function call finishes executing.
basic commands 6. step/step [count]
step [expr]
steps forward, even into the first executable statement in a function call.
step 5 will execute step 5 times
basic commands 7. display/undisplay
display [Expression]
by default, displays variable values at each step state,
undisplay removes a variable from the list of variables to be displayed automatically
basic commands 8. print
print [Expression]
print $[Previous value number]
print {[Type]}[Address]
print [First element]@[Element count]
print /[Format] [Expression]
prints the value of a given expression
basic commands 9. list
list
list [ file_name:]line_expression
list begin,end
list begin,
list ,end
list +[num]
list -[num]
list *address
displays lines of source code specified by the following:
position of the program counter,
last line listed (if multiple list commands listed)
the line numbers specified as the parameters to the list command
https://www.irya.unam.mx/computo/sites/manuales/fce12/debugger/cl/commandref/common_cmd/cmd_list.htm
basic commands 10. watch
watch lvalue
sets a write watchpoint on the specified expression
(watch variableName)
basic commands 11. quit
quit
exits the debugger
Advanced commands 1 ptype
ptype [name]
prints detailed description of a type, or the type of the last value in the command history