gdb debugger Flashcards

1
Q

command use to display contents of a general purpose register.

A

display /x $eax

view first 16 bits, display /x $ax
view 8L, display /x $al
view 8H, display /x $ah

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

how to view FPU registers in GDB

A

by default FPU is not shown,

you can issue: info all-registers to view all registers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

this flag is used with the compiler to privide GDB with debugging symbols

A

-ggdb

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

in GDB this command is used to view information about functions, * when compiled with debugging symbols.

A

info functions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

in GDB when a program is compiled with symbols, you can use this command to view GLOBAL variables

A

info variables

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

to view LOCAL variables in GDB when a program is compiled with debug symbols use this command

A

you mention scope, info scope “function”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

objcopy –only-keep-debug binary debug_output

A

This will rip off debugging symbols from a binary compiled with debugging symbols

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

This letter is use to examine a memory address in GDB

A

x
help x
x/100s 0xabcdef

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

GDB workflow

A

break main ( set break point)
run (run the program)
disassemble main ( show instructions starting at main)
x/100s xyz (examine 100 count of strings @ xyz memory address)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

examine number of instructions in GDX using x

A

x/100i 0xabcdef ( where abcdef is a memory address) you can get the memory address from EIP or ESP for example to look at all the instructions)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

what are convenience variables in GDB?

A

they allow you to store your own variables to refuse in the program, they also allow you to call C libraries.
set $test1 = (char *)malloc()

call strcpy($test1, sys.argv[1])

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

GDB allows you to call functions and parameters using “call”

A
call EchoInput("hello")
call Addnumbers(10, 20)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

set a breakpoint in specific instruction when looking at disassemble main for example

A

break *0x0804850c

you take the memory address of the instruction and prepend * to set the break point.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly