Struct gimli::write::LineProgram
source · [−]pub struct LineProgram {
pub file_has_timestamp: bool,
pub file_has_size: bool,
pub file_has_md5: bool,
/* private fields */
}
Expand description
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
sourceimpl LineProgram
impl LineProgram
sourcepub 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>)>
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>)>
Create a line number program by reading the data from the given program.
Return the program and a mapping from file index to FileId
.
sourceimpl LineProgram
impl LineProgram
sourcepub fn new(
encoding: Encoding,
line_encoding: LineEncoding,
comp_dir: LineString,
comp_file: LineString,
comp_file_info: Option<FileInfo>
) -> LineProgram
pub fn new(
encoding: Encoding,
line_encoding: LineEncoding,
comp_dir: LineString,
comp_file: LineString,
comp_file_info: Option<FileInfo>
) -> LineProgram
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.
sourcepub fn none() -> Self
pub fn none() -> Self
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.
sourcepub fn is_none(&self) -> bool
pub fn is_none(&self) -> bool
Return true if this line program was created with LineProgram::none()
.
sourcepub fn address_size(&self) -> u8
pub fn address_size(&self) -> u8
Return the address size in bytes for this line program.
sourcepub fn default_directory(&self) -> DirectoryId
pub fn default_directory(&self) -> DirectoryId
Return the id for the working directory of the compilation unit.
sourcepub fn add_directory(&mut self, directory: LineString) -> DirectoryId
pub fn add_directory(&mut self, directory: LineString) -> DirectoryId
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.
sourcepub fn get_directory(&self, id: DirectoryId) -> &LineString
pub fn get_directory(&self, id: DirectoryId) -> &LineString
sourcepub fn add_file(
&mut self,
file: LineString,
directory: DirectoryId,
info: Option<FileInfo>
) -> FileId
pub fn add_file(
&mut self,
file: LineString,
directory: DirectoryId,
info: Option<FileInfo>
) -> FileId
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.
sourcepub fn get_file(&self, id: FileId) -> (&LineString, DirectoryId)
pub fn get_file(&self, id: FileId) -> (&LineString, DirectoryId)
sourcepub fn get_file_info(&self, id: FileId) -> &FileInfo
pub fn get_file_info(&self, id: FileId) -> &FileInfo
sourcepub fn get_file_info_mut(&mut self, id: FileId) -> &mut FileInfo
pub fn get_file_info_mut(&mut self, id: FileId) -> &mut FileInfo
sourcepub fn begin_sequence(&mut self, address: Option<Address>)
pub fn begin_sequence(&mut self, address: Option<Address>)
sourcepub fn end_sequence(&mut self, address_offset: u64)
pub fn end_sequence(&mut self, address_offset: u64)
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.
sourcepub fn in_sequence(&self) -> bool
pub fn in_sequence(&self) -> bool
Return true if a sequence has begun.
sourcepub fn generate_row(&mut self)
pub fn generate_row(&mut self)
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.
sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if the line number program has no instructions.
Does not check the file or directory entries.
sourcepub fn write<W: Writer>(
&self,
w: &mut DebugLine<W>,
encoding: Encoding,
debug_line_str_offsets: &DebugLineStrOffsets,
debug_str_offsets: &DebugStrOffsets
) -> Result<DebugLineOffset>
pub fn write<W: Writer>(
&self,
w: &mut DebugLine<W>,
encoding: Encoding,
debug_line_str_offsets: &DebugLineStrOffsets,
debug_str_offsets: &DebugStrOffsets
) -> Result<DebugLineOffset>
Trait Implementations
sourceimpl Clone for LineProgram
impl Clone for LineProgram
sourcefn clone(&self) -> LineProgram
fn clone(&self) -> LineProgram
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
Auto Trait Implementations
impl RefUnwindSafe for LineProgram
impl Send for LineProgram
impl Sync for LineProgram
impl Unpin for LineProgram
impl UnwindSafe for LineProgram
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more