pub struct Call { /* private fields */ }Expand description
One live call, as a debugger sees it.
Implementations§
Source§impl Call
impl Call
Sourcepub fn function(&self) -> &str
pub fn function(&self) -> &str
module.name of the function running here.
The body that was written, which for a frame lower::inline
expanded is the leaf and not the function that holds its
instructions. Call::within is that other answer.
Sourcepub fn within(&self) -> &str
pub fn within(&self) -> &str
module.name of the function whose code Call::pc is a counter of.
The same as Call::function for a frame the machine pushed, and the
caller for one that is an expanded body: the expansion wrote the
leaf’s instructions into the caller and there is no other numbering
for them.
A reader showing a disassembly needs both, and showing one under the
other’s name is the mistake this exists to stop — a pane titled
playground.twice holding playground.main’s four instructions,
which is what a table keyed on Call::function alone produced.
Sourcepub fn pc(&self) -> Pc
pub fn pc(&self) -> Pc
Where in it this call is: the instruction about to run for the innermost call, and the one to return to for every other.
A counter of Call::within, not of Call::function.
Sourcepub fn locals(&self) -> &[Local]
pub fn locals(&self) -> &[Local]
The names the source bound that are in scope at this pc, in declaration order.
One name may appear twice. Shadowing is recorded rather than
resolved — see cove_ir::Local — so let x = 1; let x = x + 41 is
two live bindings of two words, and both are here. Call::local is
what chooses between them.
Sourcepub fn words(&self) -> &[Word]
pub fn words(&self) -> &[Word]
The frame’s own words that no name in scope covers.
For a frame that is an expanded body, that includes every word the caller holds. They are in the same physical frame — an expansion appends the callee’s run to the caller’s rather than pushing one — and they are not names this body bound, which is exactly what this reports: a word no name in scope covers, whoever else may have a name for it.
Sourcepub fn local(&self, name: &str) -> Option<&Local>
pub fn local(&self, name: &str) -> Option<&Local>
The local called name that the source means at this pc, if one is
in scope here.
The last match wins, which is
cove_ir::Function::local_at’s rule and is the rule because the
lowering resolves a name by searching its scope backwards. Two
bindings of one name are live at once and the later one is what the
source at this pc means; taking the first match would answer with the
shadowed binding, which is a debugger that is wrong about the value
of a name exactly where a person is most likely to ask.
The earlier binding is not hidden — it is still in Call::locals,
where a reader can see both — because it is still in the frame, and a
view of the machine that quietly dropped a word would be a worse
lie than a view that shows two.