1/27
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
assert()
Takes a Boolean expression as a parameter and terminates the program if it is false, but continues otherwise.
debugger
a program that runs your program within a controlled
environment
gdb
GNU Debugger
How do you start gdb
gdb [program name]
What is the flag for a simple terminal gdb interface
-tui
What is the command to run the program in gdb
run [args] (if any)
What is the command for looking at regions of code
list (l)
How do you set a breakpoint on a specific line
break (b) [line]
How do you set a breakpoint at a certain function
break (b) [function | line]
How do you delete a breakpoint
delete [breakpoint number]
conditional breakpoint
a point where you want the debugger only if the
condition holds
How do you create a conditional breakpoint
cond [breakpoint_number] (expr)
or
b [line | function] if (expr)
How do you see all of your breakpoints
info breakpoints
How can you save breakpoints in a file for later use
save breakpoints [textfile name]
How can you load saved breakpoints
source [textfile name]
Watchpoint/data breakpoint
stop execution whenever the value of a variable changes, without a particular place where it happens.
where command
gives you a stack and the specific line number you are on. Tells you where you are in the program
up and down commands
moves up and down the stack and see different variables
How do you print variables in gdb
print /[format] variable
What are the formats for binary, hex, int, unsigned int, string, octal, float, address, and instruction, respectively
t(binary), x(hex), d(int), u(unsigned int), s(string), o(octal), f(float), a(address), i(instruction)
x command
examines a memory region
How do you call the x command
x [/<num><format><size>] address
What are the applicable sizes for the x command
b(byte), h(halfword), w(word), g(giant, 8 bytes)
next(n)
goes to the next line in the program
step(s)
goes to the next line in the program, but steps into a function if there is one.
continue(c)
runs the program until it terminates or hits another breakpoint
finish(f)
continues until it reaches a return statement