#[repr(C)]pub struct DebugLocal {
pub source_name: *const u8,
pub name_len: u32,
pub symbol_id: u32,
pub descriptor: *const TypeDescriptor,
pub value: Option<DebugValue>,
pub type_id: u32,
pub kind: u8,
pub span_start: u32,
pub span_end: u32,
pub callee_name: *const u8,
pub callee_name_len: u32,
}Expand description
One local variable in a debug frame snapshot (§9.3).
Carries the source name, the compiler-assigned symbol_id (which
disambiguates shadowed bindings — two var a in the same scope get distinct
ids, §4.2), the local’s type descriptor, and the current GcRef value. The
prologue and epilogue push and pop the frames, the spill updates the values,
and the crash debugger reads them to display locals.
Fields§
§source_name: *const u8The source name as written (e.g. a). Not owned by the frame; points at
a 'static string the compiler embedded.
name_len: u32The name’s byte length.
symbol_id: u32The compiler-assigned symbol id (disambiguates shadowed bindings, §4.2).
descriptor: *const TypeDescriptorThe local’s static type descriptor (§9.3 “local type descriptors”), so
the debugger can render a local without re-deriving its type. Embedded
by the backend at push time from the MIR local’s Type. Null when the
local has no static type (MirType::Opaque — a pipeline accumulator, a
fused-loop item), alongside
NO_STATIC_TYPE in type_id; and null
on its own when the type has no runtime descriptor (Never, an
unresolved inference variable), where type_id is still a real handle.
Either way the debugger omits the type column.
value: Option<DebugValue>The current value of the local, or None for a slot no value has been
written into yet.
Decoded from the slot’s one machine word by
DebugLocalMeta::read, under the
DebugSlotKind the compiler recorded for
this local — so a temp whose box ADR-120 elided is a
DebugValue::Scalar carrying its
payload and no reference, and everything else is a
DebugValue::Reference. A
consumer that means to follow the value into the heap says so with
DebugValue::reference, which is
the one door a scalar cannot pass.
The word itself is Option<GcRef>-shaped in the slot, and the zeroed
slot a fresh frame starts with is the None niche (F18).
type_id: u32The full static Type id (a praxis_typeck::Type(u32) handle), so the
crash debugger can reconstruct the local’s exact type — including
collection element types (Vec[Int], Map[Text, Int]) and record field
shapes — which the runtime descriptor alone loses. The debugger pairs
this id with the live TypeDb to type-check p EXPR against the
selected frame (§9.5). NO_STATIC_TYPE
when the local has none; every other u32 is a valid arena index, so
there is no in-band zero sentinel.
kind: u8The debugger classification: LOCAL_KIND_USER (a binding the programmer
wrote) or LOCAL_KIND_TEMP (a compiler intermediate). See
crate::debug::LOCAL_KIND_USER.
span_start: u32The local’s source span start (byte offset), paired with span_end.
span_end: u32The local’s source span end (byte offset). (span_start, span_end) == (0, 0) means “no span” (the return slot, span-less captures).
callee_name: *const u8The function a direct call defines this local from, copied from
DebugLocalMeta::callee_name.
Null for every local that is not a direct call’s result.
callee_name_len: u32The callee name’s byte length; 0 where there is no name.
Implementations§
Source§impl DebugLocal
impl DebugLocal
Sourcepub fn name(&self) -> String
pub fn name(&self) -> String
The source name as a String. Allocates; for testing/debugger only.
Sourcepub fn is_user(&self) -> bool
pub fn is_user(&self) -> bool
True iff this local is a user-written binding (a var/param/
capture), as opposed to a compiler-generated temporary.
Sourcepub fn span(&self) -> Option<(u32, u32)>
pub fn span(&self) -> Option<(u32, u32)>
The local’s source span [start, end) (byte offsets into program
source), or None if none was threaded. None is signalled by the
(0, 0) sentinel (the zero-width span at offset 0 is not a meaningful
program location for a local that exists).
Sourcepub unsafe fn callee(&self) -> Option<&'static str>
pub unsafe fn callee(&self) -> Option<&'static str>
The function a direct call defines this local from, or None where the
local is not a direct call’s result.
§Safety
The pointer is a compiler-embedded 'static UTF-8 string — the same
contract Self::name reads source_name under — so the borrow this
returns outlives any frame it came from.
Trait Implementations§
Source§impl Clone for DebugLocal
impl Clone for DebugLocal
Source§fn clone(&self) -> DebugLocal
fn clone(&self) -> DebugLocal
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more