Struct gimli::write::LineProgram[][src]

pub struct LineProgram {
    pub file_has_timestamp: bool,
    pub file_has_size: bool,
    pub file_has_md5: bool,
    // some fields omitted
}

A line number program.

Fields

file_has_timestamp: bool

True if the file entries may have valid timestamps.

Entries may still have a timestamp of 0 even if this is set. For version <= 4, this is ignored. For version 5, this controls whether to emit DW_LNCT_timestamp.

file_has_size: bool

True if the file entries may have valid sizes.

Entries may still have a size of 0 even if this is set. For version <= 4, this is ignored. For version 5, this controls whether to emit DW_LNCT_size.

file_has_md5: bool

True if the file entries have valid MD5 checksums.

For version <= 4, this is ignored. For version 5, this controls whether to emit DW_LNCT_MD5.

Implementations

impl LineProgram[src]

pub fn from<R: Reader<Offset = usize>>(
    from_program: IncompleteLineProgram<R>,
    dwarf: &Dwarf<R>,
    line_strings: &mut LineStringTable,
    strings: &mut StringTable,
    convert_address: &dyn Fn(u64) -> Option<Address>
) -> ConvertResult<(LineProgram, Vec<FileId>)>
[src]

Create a line number program by reading the data from the given program.

Return the program and a mapping from file index to FileId.

impl LineProgram[src]

pub fn new(
    encoding: Encoding,
    line_encoding: LineEncoding,
    comp_dir: LineString,
    comp_file: LineString,
    comp_file_info: Option<FileInfo>
) -> LineProgram
[src]

Create a new LineProgram.

comp_dir defines the working directory of the compilation unit, and must be the same as the DW_AT_comp_dir attribute of the compilation unit DIE.

comp_file and comp_file_info define the primary source file of the compilation unit and must be the same as the DW_AT_name attribute of the compilation unit DIE.

Panics

Panics if line_encoding.line_base > 0.

Panics if line_encoding.line_base + line_encoding.line_range <= 0.

Panics if comp_dir is empty or contains a null byte.

Panics if comp_file is empty or contains a null byte.

pub fn none() -> Self[src]

Create a new LineProgram with no fields set.

This can be used when the LineProgram will not be used.

You should not attempt to add files or line instructions to this line program, or write it to the .debug_line section.

pub fn is_none(&self) -> bool[src]

Return true if this line program was created with LineProgram::none().

pub fn encoding(&self) -> Encoding[src]

Return the encoding parameters for this line program.

pub fn version(&self) -> u16[src]

Return the DWARF version for this line program.

pub fn address_size(&self) -> u8[src]

Return the address size in bytes for this line program.

pub fn format(&self) -> Format[src]

Return the DWARF format for this line program.

pub fn default_directory(&self) -> DirectoryId[src]

Return the id for the working directory of the compilation unit.

pub fn add_directory(&mut self, directory: LineString) -> DirectoryId[src]

Add a directory entry and return its id.

If the directory already exists, then return the id of the existing entry.

If the path is relative, then the directory is located relative to the working directory of the compilation unit.

Panics

Panics if directory is empty or contains a null byte.

pub fn get_directory(&self, id: DirectoryId) -> &LineString[src]

Get a reference to a directory entry.

Panics

Panics if id is invalid.

pub fn add_file(
    &mut self,
    file: LineString,
    directory: DirectoryId,
    info: Option<FileInfo>
) -> FileId
[src]

Add a file entry and return its id.

If the file already exists, then return the id of the existing entry.

If the file path is relative, then the file is located relative to the directory. Otherwise the directory is meaningless, but it is still used as a key for file entries.

If info is None, then new entries are assigned default information, and existing entries are unmodified.

If info is not None, then it is always assigned to the entry, even if the entry already exists.

Panics

Panics if ‘file’ is empty or contains a null byte.

pub fn get_file(&self, id: FileId) -> (&LineString, DirectoryId)[src]

Get a reference to a file entry.

Panics

Panics if id is invalid.

pub fn get_file_info(&self, id: FileId) -> &FileInfo[src]

Get a reference to the info for a file entry.

Panics

Panics if id is invalid.

pub fn get_file_info_mut(&mut self, id: FileId) -> &mut FileInfo[src]

Get a mutable reference to the info for a file entry.

Panics

Panics if id is invalid.

pub fn begin_sequence(&mut self, address: Option<Address>)[src]

Begin a new sequence and set its base address.

Panics

Panics if a sequence has already begun.

pub fn end_sequence(&mut self, address_offset: u64)[src]

End the sequence, and reset the row to its default values.

Only the address_offset and op_index` fields of the current row are used.

Panics

Panics if a sequence has not begun.

pub fn in_sequence(&self) -> bool[src]

Return true if a sequence has begun.

pub fn row(&mut self) -> &mut LineRow[src]

Returns a reference to the data for the current row.

pub fn generate_row(&mut self)[src]

Generates the line number information instructions for the current row.

After the instructions are generated, it sets discriminator to 0, and sets basic_block, prologue_end, and epilogue_begin to false.

Panics

Panics if a sequence has not begun. Panics if the address_offset decreases.

pub fn is_empty(&self) -> bool[src]

Returns true if the line number program has no instructions.

Does not check the file or directory entries.

pub fn write<W: Writer>(
    &self,
    w: &mut DebugLine<W>,
    encoding: Encoding,
    debug_line_str_offsets: &DebugLineStrOffsets,
    debug_str_offsets: &DebugStrOffsets
) -> Result<DebugLineOffset>
[src]

Write the line number program to the given section.

Panics

Panics if self.is_none().

Trait Implementations

impl Clone for LineProgram[src]

impl Debug for LineProgram[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.