跳到內容

debugging

本頁內容尚未翻譯。

record DebugRun

A run for the debugger: the machine’s configuration, the nodes it stops at (the program’s statements’), the statement node last entered at each depth of the user’s calls, and the node the last move entered (none when it entered none to stop at).

def Debugging.internal (name : String) : Bool

Whether a function or a node is the model’s own (CPython runs it in C): model sort, builtin map.<resume>, or one with no name.

def Debugging.depth (x : Configuration Run Signal Stop) : Nat

How many of the user’s calls the configuration x is in (the state’s depth: the model’s own functions do not count).

def Debugging.markedWith (code : Nat) (label : String) : Bool

Whether a label is marked with a code first.

def Debugging.forced (label : String) : Bool

Whether a label is marked to always stop (the code 1 first).

def Debugging.resumed (label : String) : Bool

Whether a label only tells the statement a resumed generator goes on with (the code 2 first).

def Debugging.nodeOf (label : String) : String

A label’s node, without the mark.

def Debugging.lastAt (last : List (Nat * String)) (depth : Nat) : Option String

The node last entered at a depth (the remembered nodes are the deepest first, none deeper than it).

def Debugging.remember (last : List (Nat * String)) (depth : Nat) (node : String) : List (Nat * String)

The remembered nodes last (none deeper than depth) with node as the one at depth.

def Debugging.atLabel (x : Configuration Run Signal Stop) (label : String) : Bool

Whether the configuration x is at label.

def Debugging.lineOf (lines : List (String * Nat)) (n : String) : Option Nat

The line of the node n in the host’s table lines.

def Debugging.sameLine (lines : List (String * Nat)) (a : String) (b : String) : Bool

Whether the nodes a and b are on the same line in the host’s table lines (not when either has none).

def Debugging.position (nodes : List String) (n : String) : Nat

The position of the node n among the program’s statement nodes (in the order of its syntax tree).

def Debugging.moved (d : DebugRun) (previous : String) (node : String) : Bool

Whether going from the statement previous, last entered at a depth, to the statement node moves to a new line, as CPython’s line event does: without the host’s table of lines in the run d, every other statement does; with it, one on another line, or one before it (a loop going back).

def Debugging.entering (d : DebugRun) (y : Configuration Run Signal Stop) : DebugRun

The run d after a move to the configuration y: the node y is about to enter, if it is one to stop at. A marked step stops when the move reaches it (not again on the move inside it) and leaves the node remembered at its depth as it was: the statement around it goes on without stopping again. A statement on the line of the one before it is remembered without stopping (Debugging.moved).

def Debugging.step (d : DebugRun) : DebugRun

One move of the run d.

def Debugging.stoppable (p : python.ast.Program) : List String

The nodes the program p stops at: its statements’ (the functions the translation makes of its comprehensions and generator expressions stop only at their marked steps, python.symbols).

def Debugging.start (p : python.ast.Program) (program : Code) (s : Run) : DebugRun

A run of the program p, translated into the code program, from its start in the state s, stopping at its statements.

def Debugging.state (d : DebugRun) : Option Run

The state of the run d (none when it stopped without one).

def Debugging.atEnd (d : DebugRun) : Bool

Whether the last read of the run d reached the end of the input without a whole line.

def Debugging.blocked (closed : Bool) (x : DebugRun) (y : DebugRun) : Bool

Whether a move from x to y waits for input: the input is not closed and the move reached its end.

def Debugging.halt (d : DebugRun) : Option (Halt String Run Raised Run)

How the run d, when finished, ends for the debugger: an uncaught exception, the end, or (what the model cannot do, or a stop) a behavior it does not specify.

def Debugging.machine : Machine DebugRun Unit String Run Raised Run

The Python model’s machine for the debugger driver.

def Debugging.stepsFrom (count : Nat) (fuel : Nat) (d : DebugRun) : List String

The nodes the run d stops at stepping in from its start to its end (at most count stops, each within fuel moves); the input given at the start and closed.

def Debugging.stopsOf (src : String) (input : String) : List String

The nodes a program stops at, its syntax tree’s JSON src, stepping in from its start with the standard input (one starting with ? when it cannot run).

def Debugging.lineTable (text : String) : List (String * Nat)

A host’s table of the lines of nodes (JSON: an object from a node to its line); empty for text it cannot read.

def Debugging.stopsWithLines (src : String) (input : String) (lines : String) : List String

The nodes a program, its syntax tree’s JSON src, stops at with the host’s table of lines (JSON), stepping in from its start with the standard input.

def Debugging.stops (src : String) (input : String) : String

The nodes a program, its syntax tree’s JSON src, stops at, stepping in from its start with the standard input, one per line.