Class Section
- java.lang.Object
-
- ghidra.app.util.bin.format.macho.Section
-
- All Implemented Interfaces:
StructConverter
public class Section extends java.lang.Object implements StructConverter
Represents a section and section_64 structure.- See Also:
- mach-o/loader.h
-
-
Constructor Summary
Constructors Constructor Description Section()DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SectioncreateSection(FactoryBundledWithBinaryReader reader, boolean is32bit)longgetAddress()intgetAlign()intgetAttributes()java.io.InputStreamgetDataStream(MachHeader header)Returns an input stream to underlying bytes of this section.intgetFlags()intgetNumberOfRelocations()intgetOffset()intgetRelocationOffset()java.util.List<RelocationInfo>getRelocations()intgetReserved1()intgetReserved2()intgetReserved3()java.lang.StringgetSectionName()java.lang.StringgetSegmentName()longgetSize()intgetType()booleanisExecute()Returns true if this section has EXECUTE permission.booleanisRead()Returns true if this section has READ permission.booleanisWrite()Returns true if this section has WRITE permission.DataTypetoDataType()Returns a structure datatype representing the contents of the implementor of this interface.java.lang.StringtoString()
-
-
-
Method Detail
-
createSection
public static Section createSection(FactoryBundledWithBinaryReader reader, boolean is32bit) throws java.io.IOException
- Throws:
java.io.IOException
-
getRelocations
public java.util.List<RelocationInfo> getRelocations()
-
isRead
public boolean isRead()
Returns true if this section has READ permission.NOTE: On a real system, sections don't have their own permissions, only the segments they live in do. However, Ghidra needs finer-grained control for analysis to work correctly, so we take control over section permissions to fit our needs.
- Returns:
- true if this section has READ permission
-
isWrite
public boolean isWrite()
Returns true if this section has WRITE permission.NOTE: On a real system, sections don't have their own permissions, only the segments they live in do. However, Ghidra needs finer-grained control for analysis to work correctly, so we take control over section permissions to fit our needs.
- Returns:
- true if this section has WRITE permission
-
isExecute
public boolean isExecute()
Returns true if this section has EXECUTE permission.NOTE: On a real system, sections don't have their own permissions, only the segments they live in do. However, Ghidra needs finer-grained control for analysis to work correctly, so we take control over section permissions to fit our needs.
- Returns:
- true if this section has EXECUTE permission
-
getDataStream
public java.io.InputStream getDataStream(MachHeader header) throws java.io.IOException
Returns an input stream to underlying bytes of this section.- Returns:
- an input stream to underlying bytes of this section
- Throws:
java.io.IOException- if an i/o error occurs.
-
getSectionName
public java.lang.String getSectionName()
-
getSegmentName
public java.lang.String getSegmentName()
-
getAddress
public long getAddress()
-
getSize
public long getSize()
-
getOffset
public int getOffset()
-
getAlign
public int getAlign()
-
getRelocationOffset
public int getRelocationOffset()
-
getNumberOfRelocations
public int getNumberOfRelocations()
-
getFlags
public int getFlags()
-
getType
public int getType()
-
getAttributes
public int getAttributes()
-
getReserved1
public int getReserved1()
-
getReserved2
public int getReserved2()
-
getReserved3
public int getReserved3()
-
toDataType
public DataType toDataType() throws DuplicateNameException, java.io.IOException
Description copied from interface:StructConverterReturns a structure datatype representing the contents of the implementor of this interface.For example, given:
class A { int foo; double bar; }The return value should be a structure data type with two data type components; an INT and a DOUBLE. The structure should contain field names and, if possible, field comments.
- Specified by:
toDataTypein interfaceStructConverter- Returns:
- returns a structure datatype representing the implementor of this interface
- Throws:
DuplicateNameException- when a datatype of the same name already existsjava.io.IOException- See Also:
StructureDataType
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-