Class CoffRelocationContext
java.lang.Object
ghidra.app.util.bin.format.coff.relocation.CoffRelocationContext
CoffRelocationContext
provide COFF relocation context data to be used by
CoffRelocationHandler
during processing of relocations.-
Constructor Summary
ConstructorDescriptionCoffRelocationContext
(Program program, CoffFileHeader header, Map<CoffSymbol, Symbol> symbolsMap) Construct COFF relocation context -
Method Summary
Modifier and TypeMethodDescriptioncomputeContextValueIfAbsent
(String key, Function<String, Object> mappingFunction) Get and optionally compute context value for specified keygetContextValue
(String key) Get context value for specified keyGet program to which relocations are being appliedGet COFF section to which relocations are being appliedgetSymbol
(CoffRelocation relocation) Get symbol required to process a relocation.getSymbolAddress
(CoffRelocation relocation) Get address of symbol required to process a relocation.void
putContextValue
(String key, Object value) Store context value for specified keyvoid
resetContext
(CoffSectionHeader coffSection) Reset context at start of COFF section relocation processing
-
Constructor Details
-
CoffRelocationContext
public CoffRelocationContext(Program program, CoffFileHeader header, Map<CoffSymbol, Symbol> symbolsMap) Construct COFF relocation context- Parameters:
program
- program to which relocations are appliedheader
- COFF file headersymbolsMap
- symbol lookup map
-
-
Method Details
-
resetContext
Reset context at start of COFF section relocation processing- Parameters:
coffSection
- COFF section
-
getProgram
Get program to which relocations are being applied- Returns:
- program
-
getSection
Get COFF section to which relocations are being applied- Returns:
- COFF section
-
getSymbol
Get symbol required to process a relocation. Method should only be invoked when a symbol is required since some relocations may not require a symbol.- Parameters:
relocation
- relocation whose related symbol should be returned- Returns:
- relocation symbol
- Throws:
RelocationException
- if symbol not found
-
getSymbolAddress
Get address of symbol required to process a relocation. Method should only be invoked when a symbol is required since some relocations may not require a symbol.- Parameters:
relocation
- relocation whose related symbol should be returned- Returns:
- relocation symbol
- Throws:
RelocationException
- if symbol not found
-
computeContextValueIfAbsent
Get and optionally compute context value for specified key- Parameters:
key
- extension-specific context keymappingFunction
- function used to compute value if absent- Returns:
- context value
-
putContextValue
Store context value for specified key- Parameters:
key
- extension-specific context keyvalue
- context value
-
getContextValue
Get context value for specified key- Parameters:
key
- extension-specific key- Returns:
- context value or null if absent
-