]>
git.proxmox.com Git - mirror_edk2.git/blob - ArmPlatformPkg/Scripts/Ds5/cmd_load_symbols.py
424eb63cbbe957a7c7ca09bfdee3a5b10f343c07
2 # Copyright (c) 2011-2012, 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
24 print "-a,--all: Load all symbols"
25 print "-l,--report=: Filename for the EDK2 report log"
26 print "-m,--sysmem=(base,size): System Memory region"
27 print "-f,--fv=(base,size): Firmware region"
28 print "-r,--rom=(base,size): ROM region"
33 opts
,args
= getopt
.getopt(sys
.argv
[1:], "har:vm:vr:vf:v", ["help","all","report=","sysmem=","rom=","fv="])
34 if (opts
is None) or (not opts
):
35 report_file
= '../../../report.log'
37 region_reg
= re
.compile("\((.*),(.*)\)")
38 base_reg
= re
.compile("(.*)")
44 if o
in ("-h","--help"):
47 elif o
in ("-a","--all"):
49 elif o
in ("-l","--report"):
51 elif o
in ("-m","--sysmem"):
52 region_type
= edk2_debugger
.ArmPlatformDebugger
.REGION_TYPE_SYSMEM
54 elif o
in ("-f","--fv"):
55 region_type
= edk2_debugger
.ArmPlatformDebugger
.REGION_TYPE_FV
57 elif o
in ("-r","--rom"):
58 region_type
= edk2_debugger
.ArmPlatformDebugger
.REGION_TYPE_ROM
61 assert False, "Unhandled option"
67 regions
.append((region_type
,int(m
.group(1),0),0))
69 regions
.append((region_type
,int(m
.group(1),0),int(m
.group(2),0)))
72 raise Exception('cmd_load_symbols', "Expect a base address")
74 raise Exception('cmd_load_symbols', "Expect a region format as (base,size)")
76 # Debugger object for accessing the debugger
79 # Initialisation commands
80 ec
= debugger
.getExecutionContext(0)
81 ec
.getExecutionService().stop()
82 ec
.getExecutionService().waitForStop()
83 # in case the execution context reference is out of date
84 ec
= debugger
.getExecutionContext(0)
86 armplatform_debugger
= edk2_debugger
.ArmPlatformDebugger(ec
, report_file
, regions
)
89 armplatform_debugger
= edk2_debugger
.ArmPlatformDebugger(ec
, report_file
, regions
)
92 armplatform_debugger
.load_all_symbols()
94 armplatform_debugger
.load_current_symbols()
95 except IOError, (ErrorNumber
, ErrorMessage
):
96 print "Error: %s" % ErrorMessage
97 except Exception, (ErrorClass
, ErrorMessage
):
98 print "Error(%s): %s" % (ErrorClass
, ErrorMessage
)
99 except DebugException
, de
:
100 print "DebugError: %s" % (de
.getMessage())