Struct gimli::read::LineProgramHeader
source · pub struct LineProgramHeader<R, Offset = <R as Reader>::Offset>where
R: Reader<Offset = Offset>,
Offset: ReaderOffset,{Show 14 fields
encoding: Encoding,
offset: DebugLineOffset<Offset>,
unit_length: Offset,
header_length: Offset,
line_encoding: LineEncoding,
opcode_base: u8,
standard_opcode_lengths: R,
directory_entry_format: Vec<FileEntryFormat>,
include_directories: Vec<AttributeValue<R, Offset>>,
file_name_entry_format: Vec<FileEntryFormat>,
file_names: Vec<FileEntry<R, Offset>>,
program_buf: R,
comp_dir: Option<R>,
comp_file: Option<FileEntry<R, Offset>>,
}
Expand description
A header for a line number program in the .debug_line
section, as defined
in section 6.2.4 of the standard.
Fields§
§encoding: Encoding
§offset: DebugLineOffset<Offset>
§unit_length: Offset
§header_length: Offset
§line_encoding: LineEncoding
§opcode_base: u8
“The number assigned to the first special opcode.”
standard_opcode_lengths: R
“This array specifies the number of LEB128 operands for each of the
standard opcodes. The first element of the array corresponds to the
opcode whose value is 1, and the last element corresponds to the opcode
whose value is opcode_base - 1
.”
directory_entry_format: Vec<FileEntryFormat>
“A sequence of directory entry format descriptions.”
include_directories: Vec<AttributeValue<R, Offset>>
Entries in this sequence describe each path that was searched for included source files in this compilation. (The paths include those directories specified explicitly by the user for the compiler to search and those the compiler searches without explicit direction.) Each path entry is either a full path name or is relative to the current directory of the compilation.
The last entry is followed by a single null byte.
file_name_entry_format: Vec<FileEntryFormat>
“A sequence of file entry format descriptions.”
file_names: Vec<FileEntry<R, Offset>>
“Entries in this sequence describe source files that contribute to the line number information for this compilation unit or is used in other contexts.”
program_buf: R
The encoded line program instructions.
comp_dir: Option<R>
The current directory of the compilation.
comp_file: Option<FileEntry<R, Offset>>
The primary source file.
Implementations§
source§impl<R, Offset> LineProgramHeader<R, Offset>where
R: Reader<Offset = Offset>,
Offset: ReaderOffset,
impl<R, Offset> LineProgramHeader<R, Offset>where
R: Reader<Offset = Offset>,
Offset: ReaderOffset,
sourcepub fn offset(&self) -> DebugLineOffset<R::Offset>
pub fn offset(&self) -> DebugLineOffset<R::Offset>
Return the offset of the line number program header in the .debug_line
section.
sourcepub fn unit_length(&self) -> R::Offset
pub fn unit_length(&self) -> R::Offset
Return the length of the line number program and header, not including the length of the encoded length itself.
sourcepub fn encoding(&self) -> Encoding
pub fn encoding(&self) -> Encoding
Return the encoding parameters for this header’s line program.
sourcepub fn header_length(&self) -> R::Offset
pub fn header_length(&self) -> R::Offset
Get the length of the encoded line number program header, not including the length of the encoded length itself.
sourcepub fn address_size(&self) -> u8
pub fn address_size(&self) -> u8
Get the size in bytes of a target machine address.
sourcepub fn line_encoding(&self) -> LineEncoding
pub fn line_encoding(&self) -> LineEncoding
Get the line encoding parameters for this header’s line program.
sourcepub fn minimum_instruction_length(&self) -> u8
pub fn minimum_instruction_length(&self) -> u8
Get the minimum instruction length any instruction in this header’s line program may have.
sourcepub fn maximum_operations_per_instruction(&self) -> u8
pub fn maximum_operations_per_instruction(&self) -> u8
Get the maximum number of operations each instruction in this header’s line program may have.
sourcepub fn default_is_stmt(&self) -> bool
pub fn default_is_stmt(&self) -> bool
Get the default value of the is_stmt
register for this header’s line
program.
sourcepub fn line_range(&self) -> u8
pub fn line_range(&self) -> u8
Get the line range for this header’s line program.
sourcepub fn opcode_base(&self) -> u8
pub fn opcode_base(&self) -> u8
Get opcode base for this header’s line program.
sourcepub fn standard_opcode_lengths(&self) -> &R
pub fn standard_opcode_lengths(&self) -> &R
An array of u8
that specifies the number of LEB128 operands for
each of the standard opcodes.
sourcepub fn directory_entry_format(&self) -> &[FileEntryFormat]
pub fn directory_entry_format(&self) -> &[FileEntryFormat]
Get the format of a directory entry.
sourcepub fn include_directories(&self) -> &[AttributeValue<R, Offset>]
pub fn include_directories(&self) -> &[AttributeValue<R, Offset>]
Get the set of include directories for this header’s line program.
For DWARF version <= 4, the compilation’s current directory is not included in the return value, but is implicitly considered to be in the set per spec.
sourcepub fn directory(&self, directory: u64) -> Option<AttributeValue<R, Offset>>
pub fn directory(&self, directory: u64) -> Option<AttributeValue<R, Offset>>
The include directory with the given directory index.
A directory index of 0 corresponds to the compilation unit directory.
sourcepub fn file_name_entry_format(&self) -> &[FileEntryFormat]
pub fn file_name_entry_format(&self) -> &[FileEntryFormat]
Get the format of a file name entry.
sourcepub fn file_has_timestamp(&self) -> bool
pub fn file_has_timestamp(&self) -> bool
Return true if the file entries may have valid timestamps.
Only returns false if we definitely know that all timestamp fields are invalid.
sourcepub fn file_has_size(&self) -> bool
pub fn file_has_size(&self) -> bool
Return true if the file entries may have valid sizes.
Only returns false if we definitely know that all size fields are invalid.
sourcepub fn file_has_md5(&self) -> bool
pub fn file_has_md5(&self) -> bool
Return true if the file name entry format contains an MD5 field.
sourcepub fn file_has_source(&self) -> bool
pub fn file_has_source(&self) -> bool
Return true if the file name entry format contains a source field.
sourcepub fn file_names(&self) -> &[FileEntry<R, Offset>]
pub fn file_names(&self) -> &[FileEntry<R, Offset>]
Get the list of source files that appear in this header’s line program.
sourcepub fn file(&self, file: u64) -> Option<&FileEntry<R, Offset>>
pub fn file(&self, file: u64) -> Option<&FileEntry<R, Offset>>
The source file with the given file index.
A file index of 0 corresponds to the compilation unit file. Note that a file index of 0 is invalid for DWARF version <= 4, but we support it anyway.
sourcepub fn raw_program_buf(&self) -> R
pub fn raw_program_buf(&self) -> R
Get the raw, un-parsed EndianSlice
containing this header’s line number
program.
use gimli::{LineProgramHeader, EndianSlice, NativeEndian};
fn get_line_number_program_header<'a>() -> LineProgramHeader<EndianSlice<'a, NativeEndian>> {
// Get a line number program header from some offset in a
// `.debug_line` section...
}
let header = get_line_number_program_header();
let raw_program = header.raw_program_buf();
println!("The length of the raw program in bytes is {}", raw_program.len());
sourcepub fn instructions(&self) -> LineInstructions<R>
pub fn instructions(&self) -> LineInstructions<R>
Iterate over the instructions in this header’s line number program, parsing them as we go.
fn parse( input: &mut R, offset: DebugLineOffset<Offset>, address_size: u8, comp_dir: Option<R>, comp_name: Option<R>, ) -> Result<LineProgramHeader<R, Offset>>
Trait Implementations§
source§impl<R, Offset> Clone for LineProgramHeader<R, Offset>
impl<R, Offset> Clone for LineProgramHeader<R, Offset>
source§fn clone(&self) -> LineProgramHeader<R, Offset>
fn clone(&self) -> LineProgramHeader<R, Offset>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<R, Offset> Debug for LineProgramHeader<R, Offset>
impl<R, Offset> Debug for LineProgramHeader<R, Offset>
source§impl<R, Offset> PartialEq for LineProgramHeader<R, Offset>
impl<R, Offset> PartialEq for LineProgramHeader<R, Offset>
source§fn eq(&self, other: &LineProgramHeader<R, Offset>) -> bool
fn eq(&self, other: &LineProgramHeader<R, Offset>) -> bool
self
and other
values to be equal, and is used
by ==
.