1/28
30 vocabulary flashcards covering key terms and commands from the CMPSC 311 lecture on debugging and gdb usage.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Debugging
The process of locating, understanding, and fixing errors where a program’s behavior diverges from expectations.
Printing / Logging
A basic debugging technique that outputs variable or memory values (e.g., using printf) at selected points in code.
assert()
C standard‐library macro that aborts the program if a specified expression is false, enforcing assumptions and catching logic errors early.
Logic / Program Guard
An assert statement used to ensure that critical conditions (e.g., non-NULL pointers, valid indices) always hold.
Debugger
A tool that executes a program in a controlled environment, allowing you to pause, inspect, and modify program state interactively.
gdb (GNU Debugger)
The most common command-line debugger on UNIX/Linux systems for C/C++ programs.
lldb
A newer debugger (LLVM project) available on macOS and many Linux systems, serving as an alternative to gdb.
run (gdb)
Starts the program inside gdb; additional arguments after run are passed to the program.
list (gdb)
Displays source code (10 lines by default) around a line number or function; alias: l.
Breakpoint
A marked location in code where execution will stop so you can inspect program state.
break (b) command
Sets a breakpoint at a specified function or line number in gdb.
delete (d) command
Removes one or more breakpoints by their number in gdb.
Conditional Breakpoint
A breakpoint that only stops execution when a given Boolean expression is true.
cond command
Attaches a condition to an existing breakpoint: cond
break … if
Sets a breakpoint and condition in one step: b
info breakpoints
Lists all current breakpoints and their status in gdb.
info command (gdb)
A family of sub-commands (info registers, info args, etc.) that report on the program and debugger state.
save breakpoints
Writes current breakpoint settings to a file so they can be reused later.
source command
Reads gdb commands (e.g., saved breakpoints) from a file and executes them.
Watchpoint
A data breakpoint that stops execution whenever the value of a specified variable or memory location changes.
where command
Displays the current call stack showing each active function and its source line.
up command
Moves one frame up the call stack, letting you inspect the calling function.
down command
Moves one frame down the call stack toward the most recent frame.
print (p) command
Evaluates and displays an expression or variable value; formats can be forced with /o, /x, /d, /t, /f, /a, /i, /s.
x command
Examines raw memory at a given address with flexible count/format/size options: x/[num][format][size]
next (n) command
Executes the next source line, stepping over function calls without entering them.
step (s) command
Executes the next source line, stepping into function calls so you can debug inside them.
continue (c) command
Resumes program execution until the next breakpoint, watchpoint, or program termination.
finish (fin) command
Continues execution until the current function returns, then stops at the caller.