Class GoSlice
java.lang.Object
ghidra.app.util.bin.format.golang.rtti.GoSlice
-
Constructor Summary
ConstructorsConstructorDescriptionGoSlice()GoSlice(long array, long len, long cap) GoSlice(long array, long len, long cap, GoRttiMapper programContext) -
Method Summary
Modifier and TypeMethodDescriptionlonglonggetCap()longgetLen()getSubSlice(long startElement, long elementCount, long elementSize) Return a artificial view of a portion of this slice's contents.booleanisFull()booleanisOffsetWithinData(long offset, int sizeofElement) booleanisValid(int elementSize) voidmarkupArray(String sliceName, DataType elementType, boolean ptr) Marks up the memory occupied by the array elements with a name and a Ghidra ArrayDataType.voidmarkupArray(String sliceName, Class<?> elementClazz, boolean ptr) Marks up the memory occupied by the array elements with a name and a Ghidra ArrayDataType, which has elements who's type is determined by the specified structure class.<T> List<T>markupArrayElements(Class<T> clazz) Marks up each element of the array, useful when the elements are themselves structures.voidmarkupElementReferences(int elementSize, List<Address> targetAddrs) Marks up each element of the array with an outbound reference to the corresponding address in the targetAddrs list.<T> List<T>readList(BinaryReader.ReaderFunction<T> readFunc) Reads the contents of the slice, treating each element as an instance of an object that can be read using the supplied reading function.<T> List<T>Reads the content of the slice, treating each element as an instance of the specified structure mapped class.long[]readUIntList(int intSize) Treats this slice as a array of unsigned integers, of the specified intSize.
-
Constructor Details
-
GoSlice
public GoSlice() -
GoSlice
public GoSlice(long array, long len, long cap) -
GoSlice
-
-
Method Details
-
getSubSlice
Return a artificial view of a portion of this slice's contents.- Parameters:
startElement-elementCount-elementSize-- Returns:
-
isValid
public boolean isValid(int elementSize) -
getArrayOffset
public long getArrayOffset() -
getArrayAddress
-
getLen
public long getLen() -
getCap
public long getCap() -
isFull
public boolean isFull() -
isOffsetWithinData
public boolean isOffsetWithinData(long offset, int sizeofElement) -
readList
Reads the content of the slice, treating each element as an instance of the specified structure mapped class.- Type Parameters:
T-- Parameters:
clazz- element type- Returns:
- list of instances
- Throws:
IOException
-
readList
Reads the contents of the slice, treating each element as an instance of an object that can be read using the supplied reading function.- Type Parameters:
T-- Parameters:
readFunc- function that will read an instance from a BinaryReader- Returns:
- list of instances
- Throws:
IOException
-
readUIntList
Treats this slice as a array of unsigned integers, of the specified intSize.- Parameters:
intSize- size of integer- Returns:
- array of longs, containing the (possibly smaller) integers contained in the slice
- Throws:
IOException- if error reading
-
markupArray
Marks up the memory occupied by the array elements with a name and a Ghidra ArrayDataType, which has elements who's type is determined by the specified structure class.- Parameters:
sliceName- used to label the memory locationelementClazz- structure mapped class of the element of the arrayptr- boolean flag, if true the element type is really a pointer to the supplied data type- Throws:
IOException- if error
-
markupArray
Marks up the memory occupied by the array elements with a name and a Ghidra ArrayDataType.- Parameters:
sliceName- used to label the memory locationelementType- Ghidra datatype of the array elements, null ok if ptr == trueptr- boolean flag, if true the element type is really a pointer to the supplied data type- Throws:
IOException- if error
-
markupArrayElements
Marks up each element of the array, useful when the elements are themselves structures.- Type Parameters:
T- structure type- Parameters:
clazz- class of the structure type- Returns:
- list of element instances
- Throws:
IOException- if error reading
-
markupElementReferences
Marks up each element of the array with an outbound reference to the corresponding address in the targetAddrs list.Useful when marking up an array of offsets.
The Listing UI doesn't show the outbound reference from each element (for arrays of primitive types), but the target will show the inbound reference.
- Parameters:
elementSize- size of each element in the arraytargetAddrs- list of addresses, should be same size as this slice- Throws:
IOException
-