pub struct DebugFunctions(/* private fields */);Expand description
The source-backed functions written to a Code section, in order. A backtrace
renders only frames whose function has a subprogram here; a body written
with plain CodeSection::function (adapters, vtable helpers) has none.
Positions are recorded relative to the section’s buffer because its leading
function count is not encoded until the section is finished;
Self::into_debug_info shifts them past it.
Implementations§
Source§impl DebugFunctions
impl DebugFunctions
Sourcepub fn write(
&mut self,
code: &mut CodeSection,
(function, lines): (Function, Vec<(u64, Span)>),
name: String,
decl_span: Span,
) -> Result<(), CompilerFailure>
pub fn write( &mut self, code: &mut CodeSection, (function, lines): (Function, Vec<(u64, Span)>), name: String, decl_span: Span, ) -> Result<(), CompilerFailure>
Writes function to code and records it under name, with control
characters escaped (see [escape_control_chars]). lines are
offsets into the body, as FunctionEmitter::build_with_lines returns them.
Code before the first row (a prologue, or an implicit constructor’s call
to its parent) is mapped to decl_span. Without that row the engine,
which looks lines up by address alone, would report the last row of the
function written before this one.
Sourcepub fn into_debug_info(
self,
count_len: u64,
) -> Result<Vec<FuncDebugInfo>, CompilerFailure>
pub fn into_debug_info( self, count_len: u64, ) -> Result<Vec<FuncDebugInfo>, CompilerFailure>
The recorded functions with addresses relative to the Code section’s
content, whose first count_len bytes encode its function count.