factor/core/debugger.facts

102 lines
6.0 KiB
Plaintext
Raw Normal View History

2006-08-01 17:35:00 -04:00
IN: errors
2006-09-06 18:06:11 -04:00
USING: alien arrays generic help kernel math memory
strings sbufs vectors io ;
2006-01-07 20:09:54 -05:00
2006-08-16 21:55:53 -04:00
HELP: :s
2006-06-04 16:20:40 -04:00
{ $description "Prints the data stack at the time of the most recent error. Used for interactive debugging." } ;
2006-01-07 20:09:54 -05:00
2006-08-16 21:55:53 -04:00
HELP: :r
2006-06-04 16:20:40 -04:00
{ $description "Prints the retain stack at the time of the most recent error. Used for interactive debugging." } ;
2006-08-16 21:55:53 -04:00
HELP: :c
2006-06-04 16:20:40 -04:00
{ $description "Prints the call stack at the time of the most recent error. Used for interactive debugging." } ;
2006-01-07 20:09:54 -05:00
2006-08-16 21:55:53 -04:00
HELP: :get
2006-01-07 20:09:54 -05:00
{ $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." } ;
2006-08-16 21:55:53 -04:00
HELP: :res
2006-06-04 16:20:40 -04:00
{ $values { "n" "a non-negative integer" } }
{ $description "Continues executing the " { $snippet "n" } "th restart." } ;
2006-08-16 21:55:53 -04:00
HELP: error.
2006-03-25 01:06:52 -05:00
{ $values { "error" "an error" } }
{ $contract "Print an error to the " { $link stdio } " stream." } ;
2006-03-25 01:06:52 -05:00
2006-08-16 21:55:53 -04:00
HELP: error-help
{ $values { "error" "an error" } { "topic" "an article name or word" } }
{ $contract "Outputs a help article which explains the error." } ;
{ error-help :help } related-words
2006-08-16 21:55:53 -04:00
HELP: print-error
2006-03-25 01:06:52 -05:00
{ $values { "error" "an error" } }
{ $description "Print an error to the " { $link stdio } " 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." } ;
2006-03-25 01:06:52 -05:00
2006-08-16 21:55:53 -04:00
HELP: try
2006-01-07 20:09:54 -05:00
{ $values { "quot" "a quotation" } }
{ $description "Calls the quotation. If it throws an error, logs the error to the " { $link stdio } " stream and restores the data stack." } ;
2006-08-01 17:35:00 -04:00
2006-08-16 21:55:53 -04:00
HELP: expired-error.
2006-08-01 17:35:00 -04:00
{ $error-description "Thrown by " { $link alien-address } " and " { $link alien-invoke } " if an " { $link alien } " object passed in as a parameter has expired. Alien objects expire if they are saved an image which is subsequently loaded; this prevents a certain class of programming errors, usually attempts to use uninitialized objects, since holding a C address is meaningless between sessions." }
{ $notes "You can check if an alien object has expired by calling " { $link expired? } "." } ;
2006-08-16 21:55:53 -04:00
HELP: io-error.
2006-08-01 17:35:00 -04:00
{ $error-description "Thrown by the C streams I/O primitives if an I/O error occurs." } ;
2006-08-16 21:55:53 -04:00
HELP: undefined-word-error.
2006-08-01 17:35:00 -04:00
{ $error-description "Thrown if an attempt is made to call a word which was defined by " { $link POSTPONE: DEFER: } "." } ;
2006-08-16 21:55:53 -04:00
HELP: type-check-error.
2006-08-01 17:35:00 -04:00
{ $error-description "Thrown by various primitives if one of the inputs does not have the expected type. Generic words throw " { $link no-method } " and " { $link no-math-method } " errors in such cases instead." } ;
HELP: divide-by-zero-error.
{ $error-description "This error is thrown when " { $link / } " or " { $link /i } " is called with with a zero denominator." }
{ $see-also "division-by-zero" } ;
2006-08-16 21:55:53 -04:00
HELP: signal-error.
2006-08-01 17:35:00 -04:00
{ $error-description
"Thrown by the runtime when a Unix signal is received. While signal numbers are system-specific, the following are relatively standard:"
{ $list
{ "4 - Illegal instruction. If you see this error, it is a bug in Factor's compiler and should be reported." }
{ "8 - Arithmetic exception. Most likely a divide by zero in " { $link /i } "." }
{ "10, 11 - Memory protection fault. This error suggests invalid values are being passed to C functions by an " { $link alien-invoke } ". Factor also uses memory protection to trap stack underflows and overflows, but usually these are reported as their own errors. Sometimes they'll show up as a generic signal 11, though." }
}
"The Windows equivalent of a signal 11 is a SEH fault. When one occurs, the runtime throws a singal error, even though it does not correspond to a Unix signal."
} ;
HELP: array-size-error.
{ $error-description "Thrown by " { $link <array> } ", " { $link <string> } ", " { $link <vector> } " and " { $link <sbuf> } " if the specified capacity is negative or too large." } ;
2006-08-01 17:35:00 -04:00
2006-08-16 21:55:53 -04:00
HELP: c-string-error.
2006-11-04 20:53:24 -05:00
{ $error-description "Thrown by " { $link alien-invoke } " and various primitives if a string containing null bytes, or characters with values higher than 255 is passed in where a C string is expected. See " { $link "c-strings" } "." } ;
2006-08-01 17:35:00 -04:00
2006-08-16 21:55:53 -04:00
HELP: ffi-error.
2006-08-01 17:35:00 -04:00
{ $error-description "Thrown by " { $link dlopen } " and " { $link dlsym } " if a problem occurs while loading a native library or looking up a symbol. See " { $link "alien" } "." } ;
2006-08-16 21:55:53 -04:00
HELP: heap-scan-error.
2006-08-01 17:35:00 -04:00
{ $error-description "Thrown if " { $link next-object } " is called outside of a " { $link begin-scan } "/" { $link end-scan } " pair." } ;
2006-08-16 21:55:53 -04:00
HELP: undefined-symbol-error.
2006-08-01 17:35:00 -04:00
{ $error-description "Thrown if a previously-compiled " { $link alien-invoke } " call refers to a native library symbol which no longer exists." } ;
2006-08-16 21:55:53 -04:00
HELP: datastack-underflow.
2006-08-01 17:35:00 -04:00
{ $error-description "Thrown by the runtime if an attempt is made to pop elements from an empty data stack." }
2006-09-06 18:06:11 -04:00
{ $notes "You can use the stack effect tool to statically check stack effects of quotations. See " { $link "inference" } "." } ;
2006-08-01 17:35:00 -04:00
2006-08-16 21:55:53 -04:00
HELP: datastack-overflow.
2006-08-01 17:35:00 -04:00
{ $error-description "Thrown by the runtime if an attempt is made to push elements on a full data stack." }
{ $notes "This error usually indicates a run-away recursion, however if you legitimately need a data stack larger than the default, see " { $link "runtime-cli-args" } "." } ;
2006-08-16 21:55:53 -04:00
HELP: retainstack-underflow.
2006-08-01 17:35:00 -04:00
{ $error-description "Thrown by the runtime if " { $link r> } " is called while the retain stack is empty." }
2006-09-06 18:06:11 -04:00
{ $notes "You can use the stack effect tool to statically check stack effects of quotations. See " { $link "inference" } "." } ;
2006-08-01 17:35:00 -04:00
2006-08-16 21:55:53 -04:00
HELP: retainstack-overflow.
2006-08-01 17:35:00 -04:00
{ $error-description "Thrown by the runtime if " { $link >r } " is called when the retain stack is full." }
{ $notes "This error usually indicates a run-away recursion, however if you legitimately need a retain stack larger than the default, see " { $link "runtime-cli-args" } "." } ;
2006-08-16 21:55:53 -04:00
HELP: callstack-overflow.
2006-08-01 17:35:00 -04:00
{ $error-description "Thrown by the runtime if the call stack is full." }
{ $notes "This error usually indicates a run-away recursion, however if you legitimately need a call stack larger than the default, see " { $link "runtime-cli-args" } "." } ;