]>
git.proxmox.com Git - mirror_edk2.git/blob - ArmPlatformPkg/Scripts/Ds5/cmd_load_symbols.py
2 # Copyright (c) 2011-2013, ARM Limited. All rights reserved.
4 # This program and the accompanying materials
5 # are licensed and made available under the terms and conditions of the BSD License
6 # which accompanies this distribution. The full text of the license may be found at
7 # http://opensource.org/licenses/bsd-license.php
9 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 from arm_ds
.debugger_v1
import Debugger
14 from arm_ds
.debugger_v1
import DebugException
16 import re
, sys
, getopt
20 # Reload external classes
25 print "-a,--all: Load all symbols"
26 print "-l,--report=: Filename for the EDK2 report log"
27 print "-m,--sysmem=(base,size): System Memory region"
28 print "-f,--fv=(base,size): Firmware region"
29 print "-r,--rom=(base,size): ROM region"
35 opts
,args
= getopt
.getopt(sys
.argv
[1:], "hvar:vm:vr:vf:v", ["help","verbose","all","report=","sysmem=","rom=","fv="])
36 if (opts
is None) or (not opts
):
37 report_file
= '../../../report.log'
39 region_reg
= re
.compile("\((.*),(.*)\)")
40 base_reg
= re
.compile("(.*)")
46 if o
in ("-h","--help"):
49 elif o
in ("-v","--verbose"):
51 elif o
in ("-a","--all"):
53 elif o
in ("-l","--report"):
55 elif o
in ("-m","--sysmem"):
56 region_type
= edk2_debugger
.ArmPlatformDebugger
.REGION_TYPE_SYSMEM
58 elif o
in ("-f","--fv"):
59 region_type
= edk2_debugger
.ArmPlatformDebugger
.REGION_TYPE_FV
61 elif o
in ("-r","--rom"):
62 region_type
= edk2_debugger
.ArmPlatformDebugger
.REGION_TYPE_ROM
65 assert False, "Unhandled option (%s)" % o
71 regions
.append((region_type
,int(m
.group(1),0),0))
73 regions
.append((region_type
,int(m
.group(1),0),int(m
.group(2),0)))
76 raise Exception('cmd_load_symbols', "Expect a base address")
78 raise Exception('cmd_load_symbols', "Expect a region format as (base,size)")
80 # Debugger object for accessing the debugger
83 # Initialisation commands
84 ec
= debugger
.getExecutionContext(0)
85 ec
.getExecutionService().stop()
86 ec
.getExecutionService().waitForStop()
87 # in case the execution context reference is out of date
88 ec
= debugger
.getExecutionContext(0)
91 armplatform_debugger
= edk2_debugger
.ArmPlatformDebugger(ec
, report_file
, regions
, verbose
)
94 armplatform_debugger
.load_all_symbols()
96 armplatform_debugger
.load_current_symbols()
97 except IOError, (ErrorNumber
, ErrorMessage
):
98 print "Error: %s" % ErrorMessage
99 except Exception, (ErrorClass
, ErrorMessage
):
100 print "Error(%s): %s" % (ErrorClass
, ErrorMessage
)
101 except DebugException
, de
:
102 print "DebugError: %s" % (de
.getMessage())