Struct goblin::mach::segment::Segment
[−]
[src]
pub struct Segment<'a> { pub cmd: u32, pub cmdsize: u32, pub segname: [u8; 16], pub vmaddr: u64, pub vmsize: u64, pub fileoff: u64, pub filesize: u64, pub maxprot: u32, pub initprot: u32, pub nsects: u32, pub flags: u32, pub data: &'a [u8], // some fields omitted }
Generalized 32/64 bit Segment Command
Fields
cmd: u32
cmdsize: u32
segname: [u8; 16]
vmaddr: u64
vmsize: u64
fileoff: u64
filesize: u64
maxprot: u32
initprot: u32
nsects: u32
flags: u32
data: &'a [u8]
Methods
impl<'a> Segment<'a>
[src]
pub fn new(ctx: Ctx, sections: &'a [u8]) -> Self
[src]
Create a new, blank segment, with cmd either LC_SEGMENT_64
, or LC_SEGMENT
, depending on ctx
.
NB You are responsible for providing a correctly marshalled byte array as the sections. You should not use this for anything other than writing.
pub fn name(&self) -> Result<&str>
[src]
Get the name of this segment
pub fn sections(&self) -> Result<Vec<(Section, SectionData<'a>)>>
[src]
Get the sections from this segment, erroring if any section couldn't be retrieved
pub fn from_32(
bytes: &'a [u8],
segment: &SegmentCommand32,
offset: usize,
ctx: Ctx
) -> Result<Self, Error>
[src]
bytes: &'a [u8],
segment: &SegmentCommand32,
offset: usize,
ctx: Ctx
) -> Result<Self, Error>
Convert the raw C 32-bit segment command to a generalized version
pub fn from_64(
bytes: &'a [u8],
segment: &SegmentCommand64,
offset: usize,
ctx: Ctx
) -> Result<Self, Error>
[src]
bytes: &'a [u8],
segment: &SegmentCommand64,
offset: usize,
ctx: Ctx
) -> Result<Self, Error>
Convert the raw C 64-bit segment command to a generalized version
Trait Implementations
impl<'a, 'b> IntoIterator for &'b Segment<'a>
[src]
type Item = Result<(Section, SectionData<'a>)>
The type of the elements being iterated over.
type IntoIter = SectionIterator<'a>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
Creates an iterator from a value. Read more
impl<'a> From<Segment<'a>> for SegmentCommand64
[src]
impl<'a> From<Segment<'a>> for SegmentCommand32
[src]
impl<'a> Debug for Segment<'a>
[src]
fn fmt(&self, fmt: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl<'a> SizeWith<Ctx> for Segment<'a>
[src]
impl<'a> TryIntoCtx<Ctx> for Segment<'a>
[src]
type Error = Error
type Size = usize
fn try_into_ctx(
self,
bytes: &mut [u8],
ctx: Ctx
) -> Result<Self::Size, Self::Error>
[src]
self,
bytes: &mut [u8],
ctx: Ctx
) -> Result<Self::Size, Self::Error>