]> git.proxmox.com Git - mirror_edk2.git/blob - EmulatorPkg/Unix/GdbRun.sh
EmulatorPkg/Unix: Fix various typos
[mirror_edk2.git] / EmulatorPkg / Unix / GdbRun.sh
1 ## @file
2 # GDB startup script
3 #
4 # Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
5 #
6 # SPDX-License-Identifier: BSD-2-Clause-Patent
7 #
8 ##
9
10 #
11 # Gdb will set $_exitcode when the program exits. Pre-init it to an unlikely
12 # return value.
13 #
14 set $_exitcode = 42
15
16 #
17 # Gdb will call hook-stop on each break. Check to see if $_exitcode was
18 # changed from the value we pre-initialized it to. If so, the program
19 # had exited, so gdb should now quit.
20 #
21 define hook-stop
22 if $_exitcode != 42
23 quit
24 else
25 source Host.gdb
26 end
27 end
28
29 #
30 # We keep track of the number of symbol files we have loaded via gdb
31 # scripts in the $SymbolFilesAdded variable
32 #
33 set $SymbolFileChangesCount = 0
34
35 #
36 # This macro adds a symbols file for gdb
37 #
38 # @param $arg0 - Symbol file changes number
39 # @param $arg1 - Symbol file name
40 # @param $arg2 - Image address
41 #
42 define AddFirmwareSymbolFile
43 if $SymbolFileChangesCount < $arg0
44 add-symbol-file $arg1 $arg2
45 set $SymbolFileChangesCount = $arg0
46 end
47 end
48
49 #
50 # This macro removes a symbols file for gdb
51 #
52 # @param $arg0 - Symbol file changes number
53 # @param $arg1 - Symbol file name
54 #
55 define RemoveFirmwareSymbolFile
56 if $SymbolFileChangesCount < $arg0
57 #
58 # Currently there is not a method to remove a single symbol file
59 #
60 set $SymbolFileChangesCount = $arg0
61 end
62 end
63
64 if gInXcode == 1
65 # in Xcode the program is already running. Issuing a run command
66 # will cause a fatal debugger error. The break point script that
67 # is used to source this script sets gInCode to 1.
68 else
69 #
70 # Start the program running
71 #
72 run
73 end