8.8.1.1.2.2.15. SymbolModule¶
- class SymbolModule¶
- load(fullPath) None¶
Unload all currently loaded symbols and load a symbol file.
symModule.load("C:/my_project/Debug/example.out")
- Parameters:
fullPath (str) -- The path to the symbol file.
- Return type:
None
- add(fullPath) None¶
Load a symbol file and add its symbols to the currently loaded symbols.
symModule.load("C:/my_project/Debug/example.out") symModule.add("C:/my_library/Debug/library.out") # Now symbols from both example.out and library.out are available
- Parameters:
fullPath (str) -- The path to the symbol file.
- Return type:
None
- remove(fullPath) None¶
Remove a symbol file from the currently loaded symbols. Symbols from other files will remain loaded.
symModule.load("C:/my_project/Debug/example.out") symModule.add("C:/my_library/Debug/library.out") # Now symbols from both example.out and library.out are available symModule.remove("C:/my_project/Debug/example.out") # Now only symbols from library.out are available
- Parameters:
fullPath (str) -- The path to the symbol file
- Return type:
None
- unloadAll() None¶
Unload all currently loaded symbols.
symModule.load("C:/my_project/Debug/example.out") symModule.add("C:/my_library/Debug/library.out") # Now symbols from both example.out and library.out are available symModule.unloadAll() # Now there are no symbols loaded
- Return type:
None
- lookupFunction(location) FunctionInfo | None¶
Lookup the function containing the given location.
func = symModule.lookupFunction(0x0020001C) if func: print(f"0x0020001C is within {func.name}") else: print("0x0020001C is not within any function in the currently loaded symbols")
- Parameters:
location (
Address) -- The address at which to look for the function.- Returns:
The information of the function if found, null otherwise.
- Return type:
FunctionInfo| None
- lookupSourceLine(location) SourceLineInfo | None¶
Lookup the source line corresponding to the given location.
line = symModule.lookupSourceLine(0x0020001C) if line: print(f"0x0020001C is on line {line.line} of {line.file}") else: print("0x0020001C is not on any source line in the currently loaded symbols")
- Parameters:
location (
Address) -- The address at which to look for the source line.- Returns:
The information of the source line if found, null otherwise.
- Return type:
SourceLineInfo| None
- findFirstSymbolValue(name) int | str | None¶
Like :py:meth:
~SymbolRootObject.findSymbolValuesbut returns the value of the first symbol found.value = symModule.findFirstSymbolValue("foo") if value: print(f"There is a symbol named 'foo' with value {value}") else: print("There is no symbol named 'foo'")
- Parameters:
name (str) -- The name of the symbol to find.
- Returns:
The value of the symbol if found, null otherwise.
- Return type:
int | str | None
- findSymbolValues(name) list[int | str]¶
Find the value of all symbols with a given name.
values = symModule.findSymbolValues("foo") print(f"There are {len(values)} symbols named 'foo' with values:") for value in values: print(f" {value}")
- Parameters:
name (str) -- The name of the symbol(s) to find.
- Returns:
A list of values for the symbols found.
- Return type:
list[int | str]
- disassemble(start, end) DisassemblyResult¶
Disassemble the given address range using the contents of the loaded object files. Both the start and end addresses are included in the range.
The text returned for each row of disassembly includes the address, opcode bytes, and the disassembled instruction.
result = symModule.disassemble(0x00200000, 0x00201000) print("Disassembly:") for line in result['disassembly']: print(f" {line['text']}") # This might output the following # # Disassembly: # 20005494 B580 push {r7, lr} # 20005496 FFF9F7FF bl 0x2000548c <foo> # 2000549A BD80 pop {r7, pc} # 2000549C 2001 movs r0, #0x1 # ...
- Parameters:
- Return type: