factor/library/tools/debugger.facts

43 lines
1.9 KiB
Plaintext

USING: errors help ;
HELP: error f
{ $description "Global variable holding most recently thrown error." }
{ $notes "Only updated by " { $link throw } ", not " { $link rethrow } "." } ;
HELP: error-continuation f
{ $description "Global variable holding current continuation of most recently thrown error." }
{ $notes "Only updated by " { $link throw } ", not " { $link rethrow } "." } ;
HELP: restarts f
{ $description "Global variable holding the set of possible restarts for the most recently thrown error." }
{ $notes "Only updated by " { $link throw } ", not " { $link rethrow } "." } ;
HELP: :s "( -- )"
{ $description "Prints the data stack at the time of the most recent error. Used for interactive debugging." } ;
HELP: :r "( -- )"
{ $description "Prints the retain stack at the time of the most recent error. Used for interactive debugging." } ;
HELP: :c "( -- )"
{ $description "Prints the call stack at the time of the most recent error. Used for interactive debugging." } ;
HELP: :get "( variable -- value )"
{ $values { "variable" "an object" } { "value" "the value, or f" } }
{ $description "Looks up the value of a variable at the time of the most recent error." } ;
HELP: :res "( n -- )"
{ $values { "n" "a non-negative integer" } }
{ $description "Continues executing the " { $snippet "n" } "th restart." } ;
HELP: error. "( error -- )"
{ $values { "error" "an error" } }
{ $contract "Print an error to the default stream." } ;
HELP: print-error "( error -- )"
{ $values { "error" "an error" } }
{ $description "Print an error to the default stream. This word gets called by the listener and other tools which report caught errors to the user. You can define methods on this generic word for custom error reporting." } ;
HELP: try "( quot -- )"
{ $values { "quot" "a quotation" } }
{ $description "Calls the quotation. If it throws an error, logs the error to the default stream and restores the datastack." } ;