pub struct DebugInfo {
pub source_map: SourceMap,
pub line_numbers: Vec<(usize, u16, u32)>,
pub variable_names: Vec<(u16, String)>,
pub source_text: String,
}Expand description
Debug information for better error messages
Supports multi-file programs by tracking which file each instruction came from. This is essential for correct error reporting after modules are merged together.
Fields§
§source_map: SourceMapSource file table for multi-file support
line_numbers: Vec<(usize, u16, u32)>Line number mappings: (instruction_index, file_id, line_number) The file_id indexes into source_map.files
variable_names: Vec<(u16, String)>Variable name mappings
source_text: StringLegacy: Source text for showing context in error messages Deprecated: Use source_map.source_texts instead
Implementations§
Source§impl DebugInfo
impl DebugInfo
Sourcepub fn add_line(&mut self, instruction_idx: usize, file_id: u16, line: u32)
pub fn add_line(&mut self, instruction_idx: usize, file_id: u16, line: u32)
Add a line number mapping for an instruction
Sourcepub fn get_location_for_instruction(&self, ip: usize) -> Option<(u16, u32)>
pub fn get_location_for_instruction(&self, ip: usize) -> Option<(u16, u32)>
Get line number and file for an instruction index
Sourcepub fn get_line_for_instruction(&self, ip: usize) -> Option<u32>
pub fn get_line_for_instruction(&self, ip: usize) -> Option<u32>
Get line number for an instruction index (legacy, file_id=0)
Sourcepub fn get_source_line(&self, line: usize) -> Option<&str>
pub fn get_source_line(&self, line: usize) -> Option<&str>
Get a source line by line number (1-indexed) from the primary file
Sourcepub fn get_source_line_from_file(
&self,
file_id: u16,
line: usize,
) -> Option<&str>
pub fn get_source_line_from_file( &self, file_id: u16, line: usize, ) -> Option<&str>
Get a source line from a specific file
Sourcepub fn get_file_for_instruction(&self, ip: usize) -> Option<&str>
pub fn get_file_for_instruction(&self, ip: usize) -> Option<&str>
Get the file name for an instruction
Trait Implementations§
Source§impl<'de> Deserialize<'de> for DebugInfo
impl<'de> Deserialize<'de> for DebugInfo
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for DebugInfo
impl RefUnwindSafe for DebugInfo
impl Send for DebugInfo
impl Sync for DebugInfo
impl Unpin for DebugInfo
impl UnsafeUnpin for DebugInfo
impl UnwindSafe for DebugInfo
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more