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
Advanced commands 2. catch
catch [signal_ID]
catches and handles the specified signal.
debugger does not make an entry in the beakpoint table for catch command,
a catch that has already being caught, does not create an additional breakpoint for that signal.
catch without parameter lists all signals currently being handled.
https://www.irya.unam.mx/computo/sites/manuales/fce12/debugger/cl/commandref/idb_mode/cmd_catch.htm
vanced commands 3. clear
clear [{func | line | *addr}] [if cond] [thread thread]
clear a breakpoint at the specified location.
if none specified, removes the breakpoint from the next instruction to be executed.
Advanced commands 4. up
up [num]
move (backwards) to the previous stack frame, or one of the frames preceeding it
Advanced commands 5. down
opposite of up, moving to the next stack frames.
Advanced Commands 6. where/backtrace
where [num] [thread { thread_id, … | all | * } ]
show the current stack trace of currently active functions.
backtrace [full] [num]
prints backtrace of stack frames
- until
until [line]
continues the debugee past the current line until the specified source line in the current stack frame.
- call
call expression (parmlist)
call a function in the dubuggee
specify the function as if you were calling it from within the appication