]> git.proxmox.com Git - mirror_edk2.git/blame - EmulatorPkg/Unix/GdbRun.sh
EmulatorPkg/Unix: Fix various typos
[mirror_edk2.git] / EmulatorPkg / Unix / GdbRun.sh
CommitLineData
fe7e504f 1## @file
2# GDB startup script
3#
4# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
5#
e3ba31da 6# SPDX-License-Identifier: BSD-2-Clause-Patent
fe7e504f 7#
8##
9
10#
11# Gdb will set $_exitcode when the program exits. Pre-init it to an unlikely
12# return value.
13#
14set $_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#
21define hook-stop
22 if $_exitcode != 42
23 quit
0bc9421b 24 else
59ad461d 25 source Host.gdb
0bc9421b 26 end
27end
28
29#
30# We keep track of the number of symbol files we have loaded via gdb
31# scripts in the $SymbolFilesAdded variable
32#
33set $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#
42define AddFirmwareSymbolFile
43 if $SymbolFileChangesCount < $arg0
44 add-symbol-file $arg1 $arg2
45 set $SymbolFileChangesCount = $arg0
46 end
47end
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#
55define RemoveFirmwareSymbolFile
56 if $SymbolFileChangesCount < $arg0
57 #
58 # Currently there is not a method to remove a single symbol file
59 #
60 set $SymbolFileChangesCount = $arg0
fe7e504f 61 end
62end
63
f70c2a12 64if gInXcode == 1
26cfe2c6
AC
65 # in Xcode the program is already running. Issuing a run command
66 # will cause a fatal debugger error. The break point script that
d18d8a1d 67 # is used to source this script sets gInCode to 1.
f70c2a12 68else
69 #
70 # Start the program running
71 #
72 run
73end