Debugging

0.0(0)
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/27

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

28 Terms

1
New cards

assert()

Takes a Boolean expression as a parameter and terminates the program if it is false, but continues otherwise.

2
New cards

debugger

a program that runs your program within a controlled
environment

3
New cards

gdb

GNU Debugger

4
New cards

How do you start gdb

gdb [program name]

5
New cards

What is the flag for a simple terminal gdb interface

-tui

6
New cards

What is the command to run the program in gdb

run [args] (if any)

7
New cards

What is the command for looking at regions of code

list (l)

8
New cards

How do you set a breakpoint on a specific line

break (b) [line]

9
New cards

How do you set a breakpoint at a certain function

break (b) [function | line]

10
New cards

How do you delete a breakpoint

delete [breakpoint number]

11
New cards

conditional breakpoint

a point where you want the debugger only if the
condition holds

12
New cards

How do you create a conditional breakpoint

cond [breakpoint_number] (expr)
or
b [line | function] if (expr)

13
New cards

How do you see all of your breakpoints

info breakpoints

14
New cards

How can you save breakpoints in a file for later use

save breakpoints [textfile name]

15
New cards

How can you load saved breakpoints

source [textfile name]

16
New cards

Watchpoint/data breakpoint

stop execution whenever the value of a variable changes, without a particular place where it happens.

17
New cards

where command

gives you a stack and the specific line number you are on. Tells you where you are in the program

18
New cards

up and down commands

moves up and down the stack and see different variables

19
New cards

How do you print variables in gdb

print /[format] variable

20
New cards

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)

21
New cards

x command

examines a memory region

22
New cards

How do you call the x command

x [/<num><format><size>] address

23
New cards

What are the applicable sizes for the x command

b(byte), h(halfword), w(word), g(giant, 8 bytes)

24
New cards

next(n)

goes to the next line in the program

25
New cards

step(s)

goes to the next line in the program, but steps into a function if there is one.

26
New cards

continue(c)

runs the program until it terminates or hits another breakpoint

27
New cards

finish(f)

continues until it reaches a return statement

28
New cards