summaryrefslogtreecommitdiffstats
path: root/documentation/GDB commands
blob: 1cbd2ac2b9439d95ab375daa9c08a316e9cd5f65 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
###################################################################
######################                #############################
###			GDB COMMANDS				###
######################                #############################
###################################################################

QEMU CONFIGURATION

	qemu must be started with "-s" option
	(shorthand for "-gdb tcp::1234")

#
# GDB PART 
#

SYMBOL FILES
	add-symbol-file Hello.debug 0x... -s .data 0x...


CONNECTION
	- source gdbscript 
		(if a gdbscript is created, which contains
		add-symbol-file commandos)

	- target remote localhost:1234

DISCONNECTION
	- detach
		break connection with target, target resumes execution
		GDB				Target
		(RSP Client)			(RSP Server)
				D
		O------------------------------>O
						O RSP exchange
		O<------------------------------O
				OK
	-disconnect
		Simply break connection. Target stays at the point where execution terminated previously
		Reconnection(target remote): resume debugging at the point where the previous connection was broken

BREAKPOINTS

	- b CoreHandleProtocol 	|| or OutputString
	- break *0x65fe447	|| set breakpoint at address
	- delete 2		|| delete breakpoint no 2
	- break sampleApp.c:nn=LineNumber


INFORMATION

	- info 		
		address SYM	|| Get address for symbol SYM
		symbol ADDR	|| Show symbol at specified address

		all-registers	|| all registers & their contents
		
		breakpoints
		
		files		|| get Entry point + sections
		files		|| Names of targets & files being debugged

		functions	|| all function names in Program
		functions UefiMain  || show where this function occurs

		line

		types [regex]	|| list all types or with regex

		args		|| Argument variables of current stack frame
		locals		|| local variables of current stack frame
		variables	|| all gloabl & static variables


CONTROL FLOW

	- c			|| continue
	- next			|| move only one step forward
	- bt			|| print back_trace of all stack frames
	- stop			|| stop program until it reaches a different source line

FILES (perhaps not applicable when debugging with QEMU)

	- file MemtestEfi.efi	|| load file   ...no debugging symbols found...done
	- file			|| unload files

LIST

	- list			|| list specified function or line

gdb --tui
	- layout asm
	- layout reg
	- layout src

	- tui enable
	- tui disable

	- next

	- ctrl+x o		|| change active window