Package ghidra.app.util.bin.format.ne
Class Segment
- java.lang.Object
-
- ghidra.app.util.bin.format.ne.Segment
-
public class Segment extends java.lang.Object
A class to represent a new-executable segment.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
getBytes()
Returns the bytes the comprise this segment.short
getFlagword()
Returns the flag word of this segment.short
getLength()
Returns the length of this segment.short
getMinAllocSize()
Returns the minimum allocation size of this segment.short
getOffset()
Returns the offset to the contents of this segment.int
getOffsetShiftAligned()
Returns the actual (shifted) offset to the contents.SegmentRelocation[]
getRelocations()
Returns an array of the relocations defined for this segment.int
getSegmentID()
Returns segment ID.boolean
hasRelocation()
Returns true if this segment has relocations.boolean
is32bit()
Returns true if the segment should operate in 32 bit mode.boolean
isCode()
Returns true if this is a code segment.boolean
isData()
Returns true if this is a data segment.boolean
isDiscardable()
Returns true if this segment is discardable.boolean
isExecuteOnly()
Returns true if this segment is execute-only.boolean
isLoaded()
Returns true if this segment is loaded.boolean
isLoaderAllocated()
Returns true if this segment is loader allocated.boolean
isMoveable()
Returns true if this segment is moveable.boolean
isPreload()
Returns true if this segment is preloaded.boolean
isPure()
Returns true if this segment is pure.boolean
isReadOnly()
Returns true if this segment is read-only.
-
-
-
Method Detail
-
getSegmentID
public int getSegmentID()
Returns segment ID.- Returns:
- segment ID
-
is32bit
public boolean is32bit()
Returns true if the segment should operate in 32 bit mode.- Returns:
- true if the segment should operate in 32 bit mode
-
isCode
public boolean isCode()
Returns true if this is a code segment.- Returns:
- true if this is a code segment
-
isData
public boolean isData()
Returns true if this is a data segment.- Returns:
- true if this is a data segment
-
hasRelocation
public boolean hasRelocation()
Returns true if this segment has relocations.- Returns:
- true if this segment has relocations
-
isLoaderAllocated
public boolean isLoaderAllocated()
Returns true if this segment is loader allocated.- Returns:
- true if this segment is loader allocated
-
isLoaded
public boolean isLoaded()
Returns true if this segment is loaded.- Returns:
- true if this segment is loaded
-
isMoveable
public boolean isMoveable()
Returns true if this segment is moveable.- Returns:
- true if this segment is moveable
-
isPreload
public boolean isPreload()
Returns true if this segment is preloaded.- Returns:
- true if this segment is preloaded
-
isPure
public boolean isPure()
Returns true if this segment is pure.- Returns:
- true if this segment is pure
-
isReadOnly
public boolean isReadOnly()
Returns true if this segment is read-only.- Returns:
- true if this segment is read-only
-
isExecuteOnly
public boolean isExecuteOnly()
Returns true if this segment is execute-only.- Returns:
- true if this segment is execute-only
-
isDiscardable
public boolean isDiscardable()
Returns true if this segment is discardable.- Returns:
- true if this segment is discardable
-
getFlagword
public short getFlagword()
Returns the flag word of this segment.- Returns:
- the flag word of this segment
-
getLength
public short getLength()
Returns the length of this segment.- Returns:
- the length of this segment
-
getMinAllocSize
public short getMinAllocSize()
Returns the minimum allocation size of this segment.- Returns:
- the minimum allocation size of this segment
-
getOffset
public short getOffset()
Returns the offset to the contents of this segment. NOTE: This value needs to be shift aligned.- Returns:
- the offset to the contents of this segment
-
getOffsetShiftAligned
public int getOffsetShiftAligned()
Returns the actual (shifted) offset to the contents.- Returns:
- the actual (shifted) offset to the contents
-
getRelocations
public SegmentRelocation[] getRelocations()
Returns an array of the relocations defined for this segment.- Returns:
- an array of the relocations defined for this segment
-
getBytes
public byte[] getBytes() throws java.io.IOException
Returns the bytes the comprise this segment. The size of the byte array is MAX(length,minalloc).- Returns:
- the bytes the comprise this segment
- Throws:
java.io.IOException
-
-