Class DWARFRegisterMappingsManager
java.lang.Object
ghidra.app.util.bin.format.dwarf4.next.DWARFRegisterMappingsManager
Factory class to instantiate and cache
DWARFRegisterMappings
objects.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ResourceFile
ReturnsResourceFile
that should contain the specified language's DWARF register mapping, never null.static DWARFRegisterMappings
getMappingForLang
(Language lang) Returns a possibly cachedDWARFRegisterMappings
object for the specified language,static boolean
Returns true if the specifiedLanguage
has DWARF register mappings.static boolean
hasDWARFRegisterMapping
(LanguageDescription langDesc) Returns true if the specifiedLanguageDescription
has DWARF register mappings.static DWARFRegisterMappings
readMappingForLang
(Language lang) Finds the DWARF register mapping information file specified in the specified language's LDEF file and returns a newDWARFRegisterMappings
object containing the data read from that file.static DWARFRegisterMappings
readMappingFrom
(org.jdom.Element rootElem, Language lang) Creates a newDWARFRegisterMappings
from the data present in the xml element.
-
Constructor Details
-
DWARFRegisterMappingsManager
public DWARFRegisterMappingsManager()
-
-
Method Details
-
hasDWARFRegisterMapping
Returns true if the specifiedLanguageDescription
has DWARF register mappings.- Parameters:
langDesc
- TheLanguageDescription
to test- Returns:
- true if the language has a DWARF register mapping specified
- Throws:
IOException
- if there was an error in the language LDEF file.
-
hasDWARFRegisterMapping
Returns true if the specifiedLanguage
has DWARF register mappings.- Parameters:
lang
- TheLanguage
to test- Returns:
- true if the language has a DWARF register mapping specified
- Throws:
IOException
- if there was an error in the language LDEF file.
-
getMappingForLang
Returns a possibly cachedDWARFRegisterMappings
object for the specified language,- Parameters:
lang
-Language
to get the matching DWARF register mappings for- Returns:
DWARFRegisterMappings
instance, never null- Throws:
IOException
- if mapping not found or invalid
-
getDWARFRegisterMappingFileFor
ReturnsResourceFile
that should contain the specified language's DWARF register mapping, never null.- Parameters:
lang
-Language
to find the mapping file for.- Returns:
ResourceFile
of where the mapping file should be, never null.- Throws:
IOException
- if not a Sleigh language or no mapping specified or multiple mappings specified.
-
readMappingForLang
Finds the DWARF register mapping information file specified in the specified language's LDEF file and returns a newDWARFRegisterMappings
object containing the data read from that file.Throws
IOException
if the lang does not have a mapping or it is invalid.- Parameters:
lang
-Language
to read the matching DWARF register mappings for- Returns:
- a new
DWARFRegisterMappings
instance, created from information read from theDWARF_REGISTER_MAPPING_NAME
xml file referenced in the language's LDEF, never null. - Throws:
IOException
- if there is no DWARF register mapping file associated with the specifiedLanguage
or if there was an error in the register mapping data.
-
readMappingFrom
public static DWARFRegisterMappings readMappingFrom(org.jdom.Element rootElem, Language lang) throws IOException Creates a newDWARFRegisterMappings
from the data present in the xml element.- Parameters:
rootElem
- JDom XML element containing the <dwarf> root element of the mapping file.lang
- The GhidraLanguage
that the DWARF register mapping applies to- Returns:
- a new
DWARFRegisterMappings
instance, never null. - Throws:
IOException
- if missing or invalid data found in xml
-