Package ghidra.app.cmd.data.rtti.gcc
Class GnuUtils
java.lang.Object
ghidra.app.cmd.data.rtti.gcc.GnuUtils
public final class GnuUtils extends Object
Static Utility Class for GNU Binaries
-
Field Summary
Fields Modifier and Type Field Description static Set<String>
COMPILER_NAMES
-
Method Summary
Modifier and Type Method Description static List<MemoryBlock>
getAllDataBlocks(Program program)
Deprecated, for removal: This API element is subject to removal in a future version.static CategoryPath
getCxxAbiCategoryPath()
Gets the "__cxxabiv1" CategoryPathstatic Set<Address>
getDirectDataReferences(Program program, Address address)
Gets all direct data references to the specified addressstatic Set<Address>
getDirectDataReferences(Program program, Address address, TaskMonitor monitor)
Gets all direct data references to the specified addressstatic Program
getExternalProgram(Program program, Relocation reloc)
Attempts to get the Program containing the data for the relocationstatic DataType
getPtrDiff_t(DataTypeManager dtm)
Gets the appropriate TypeDefDataType for the builtin __PTRDIFF_TYPE__static int
getPtrDiffSize(DataTypeManager dtm)
Gets the size in bytes of __PTRDIFF_TYPE__static boolean
hasFunctionDescriptors(Program program)
Checks if a Program's language is PowerPC64static boolean
isDataBlock(MemoryBlock block)
Deprecated, for removal: This API element is subject to removal in a future version.static boolean
isDataPointer(MemBuffer buf)
Checks if a valid pointer to a .*data section address is located at the specified addressstatic boolean
isExternal(Program program, Address address)
Checks if the provided address is located within the "EXTERNAL" memory block.static boolean
isFunctionPointer(Program program, Address address)
Checks if a function pointer is located at the specified addressstatic boolean
isGnuCompiler(Program program)
Checks if the Program was compiled by a GNU variantstatic boolean
isLLP64(DataTypeManager dtm)
static boolean
isNullPointer(Program program, Address address)
Checks if a null pointer is located at the specified addressstatic boolean
isNullPointer(MemBuffer buf)
Checks if a null pointer is located at the specified addressstatic boolean
isValidPointer(Program program, Address address)
Checks if a valid pointer is located at the specified addressstatic boolean
isValidPointer(MemBuffer buf)
Checks if a valid pointer is located at the specified address
-
Field Details
-
COMPILER_NAMES
-
-
Method Details
-
getCxxAbiCategoryPath
Gets the "__cxxabiv1" CategoryPath- Returns:
- the "__cxxabiv1" CategoryPath
-
isLLP64
- Parameters:
dtm
- the programs datatype manager- Returns:
- true if LLP64 was defined
-
getPtrDiff_t
Gets the appropriate TypeDefDataType for the builtin __PTRDIFF_TYPE__- Parameters:
dtm
- the programs datatype manager- Returns:
- the appropriate TypeDefDataType for the builtin __PTRDIFF_TYPE__
-
getPtrDiffSize
Gets the size in bytes of __PTRDIFF_TYPE__- Parameters:
dtm
- the programs datatype manager- Returns:
- the size in bytes of __PTRDIFF_TYPE__
-
getAllDataBlocks
Deprecated, for removal: This API element is subject to removal in a future version.Gets all MemoryBlocks in a Program which hold non-volatile data- Parameters:
program
- the program to be searched- Returns:
- A list of all memory blocks whose name contains "data" with non-volatile data
-
isDataBlock
Deprecated, for removal: This API element is subject to removal in a future version.Returns true if this MemoryBlock has non-volatile data- Parameters:
block
- the memory block to test- Returns:
- true if this MemoryBlock has non-volatile data
-
hasFunctionDescriptors
Checks if a Program's language is PowerPC64- Parameters:
program
- the program to test- Returns:
- true if the program's language is PowerPC64
-
isGnuCompiler
Checks if the Program was compiled by a GNU variant- Parameters:
program
- the program to check- Returns:
- true if compiled by a GNU variant
-
isFunctionPointer
Checks if a function pointer is located at the specified address- Parameters:
program
- the program containing the dataaddress
- the address of the data- Returns:
- true if a function pointer is located at the specified address
-
isNullPointer
Checks if a null pointer is located at the specified address- Parameters:
program
- the program containing the dataaddress
- the address of the data- Returns:
- true if a null pointer is located at the specified address
-
isNullPointer
Checks if a null pointer is located at the specified address- Parameters:
buf
- the memory buffer containing the data- Returns:
- true if a null pointer is located at the specified address
-
isValidPointer
Checks if a valid pointer is located at the specified address- Parameters:
program
- the program containing the dataaddress
- the address of the data- Returns:
- true if a valid pointer is located at the specified address
-
isValidPointer
Checks if a valid pointer is located at the specified address- Parameters:
buf
- the memory buffer containing the data- Returns:
- true if a valid pointer is located at the specified address
-
isDataPointer
Checks if a valid pointer to a .*data section address is located at the specified address- Parameters:
buf
- the memory buffer containing the data- Returns:
- true if a valid data pointer is located at the specified address
-
getDirectDataReferences
Gets all direct data references to the specified address- Parameters:
program
- the program containing the dataaddress
- the address of the data- Returns:
- a set of all direct data references to the specified address
-
getDirectDataReferences
public static Set<Address> getDirectDataReferences(Program program, Address address, TaskMonitor monitor) throws CancelledExceptionGets all direct data references to the specified address- Parameters:
program
- the program containing the dataaddress
- the address of the datamonitor
- the task monitor- Returns:
- a set of all direct data references to the specified address
- Throws:
CancelledException
- if the search is cancelled
-
getExternalProgram
Attempts to get the Program containing the data for the relocation- Parameters:
program
- the program containing the relocationreloc
- the relocation- Returns:
- the external program or null if not resolved
-
isExternal
Checks if the provided address is located within the "EXTERNAL" memory block.- Parameters:
program
- the program containing the addressaddress
- the address to check- Returns:
- true if it is an external address
-
CppClassAnalyzerUtils.getAllDataBlocks(Program)