diff --git a/basis/bootstrap/threads/threads.factor b/basis/bootstrap/threads/threads.factor index 8f4a05ef52..6c30489bb4 100644 --- a/basis/bootstrap/threads/threads.factor +++ b/basis/bootstrap/threads/threads.factor @@ -4,3 +4,4 @@ IN: bootstrap.threads USE: io.thread USE: threads +USE: debugger.threads diff --git a/basis/concurrency/mailboxes/mailboxes.factor b/basis/concurrency/mailboxes/mailboxes.factor index b7d9e46aa8..11624ab473 100755 --- a/basis/concurrency/mailboxes/mailboxes.factor +++ b/basis/concurrency/mailboxes/mailboxes.factor @@ -4,7 +4,7 @@ IN: concurrency.mailboxes USING: dlists dequeues threads sequences continuations destructors namespaces random math quotations words kernel arrays assocs init system concurrency.conditions accessors -debugger ; +debugger debugger.threads ; TUPLE: mailbox threads data disposed ; diff --git a/basis/debugger/debugger.factor b/basis/debugger/debugger.factor index a33b6ce8aa..eacbd6a125 100755 --- a/basis/debugger/debugger.factor +++ b/basis/debugger/debugger.factor @@ -5,10 +5,10 @@ kernel math namespaces prettyprint prettyprint.config sequences assocs sequences.private strings io.styles io.files vectors words system splitting math.parser classes.tuple continuations continuations.private combinators generic.math classes.builtin -classes compiler.units generic.standard vocabs threads -threads.private init kernel.private libc io.encodings accessors -math.order destructors source-files parser classes.tuple.parser -effects.parser lexer compiler.errors dlists generic.parser +classes compiler.units generic.standard vocabs init +kernel.private io.encodings accessors math.order +destructors source-files parser classes.tuple.parser +effects.parser lexer compiler.errors generic.parser strings.parser ; IN: debugger @@ -245,33 +245,6 @@ M: no-compilation-unit error. M: no-vocab summary drop "Vocabulary does not exist" ; -M: bad-ptr summary - drop "Memory allocation failed" ; - -M: double-free summary - drop "Free failed since memory is not allocated" ; - -M: realloc-error summary - drop "Memory reallocation failed" ; - -: error-in-thread. ( thread -- ) - "Error in thread " write - [ - dup thread-id # - " (" % dup thread-name % - ", " % dup thread-quot unparse-short % ")" % - ] "" make swap write-object ":" print nl ; - -! Hooks -M: thread error-in-thread ( error thread -- ) - initial-thread get-global eq? [ - die drop - ] [ - global [ - error-thread get-global error-in-thread. print-error flush - ] bind - ] if ; - M: encode-error summary drop "Character encoding error" ; M: decode-error summary drop "Character decoding error" ; @@ -348,9 +321,6 @@ M: object compiler-error. ( error word -- ) nl print-error ; -M: empty-dlist summary ( dlist -- ) - drop "Empty dlist" ; - M: bad-effect summary drop "Bad stack effect declaration" ; diff --git a/basis/debugger/threads/threads.factor b/basis/debugger/threads/threads.factor new file mode 100644 index 0000000000..90d70f6754 --- /dev/null +++ b/basis/debugger/threads/threads.factor @@ -0,0 +1,22 @@ +! Copyright (C) 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: accessors debugger continuations threads threads.private +io io.styles prettyprint kernel math.parser namespaces ; +IN: debugger.threads + +: error-in-thread. ( thread -- ) + "Error in thread " write + [ + dup id>> # + " (" % dup name>> % + ", " % dup quot>> unparse-short % ")" % + ] "" make swap write-object ":" print nl ; + +M: thread error-in-thread ( error thread -- ) + initial-thread get-global eq? [ + die drop + ] [ + global [ + error-thread get-global error-in-thread. print-error flush + ] bind + ] if ; diff --git a/basis/dlists/dlists.factor b/basis/dlists/dlists.factor index 192b5cb948..91a5f610ad 100755 --- a/basis/dlists/dlists.factor +++ b/basis/dlists/dlists.factor @@ -1,7 +1,8 @@ ! Copyright (C) 2007, 2008 Mackenzie Straight, Doug Coleman, ! Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: combinators kernel math sequences accessors dequeues ; +USING: combinators kernel math sequences accessors dequeues +summary ; IN: dlists TUPLE: dlist front back length ; @@ -80,6 +81,9 @@ M: dlist push-back* ( obj dlist -- dlist-node ) ERROR: empty-dlist ; +M: empty-dlist summary ( dlist -- ) + drop "Empty dlist" ; + M: dlist peek-front ( dlist -- obj ) front>> [ obj>> ] [ empty-dlist ] if* ; diff --git a/basis/libc/libc.factor b/basis/libc/libc.factor index 627caa7b77..cf4e2fb722 100755 --- a/basis/libc/libc.factor +++ b/basis/libc/libc.factor @@ -3,7 +3,7 @@ ! Copyright (C) 2007, 2008 Doug Coleman ! See http://factorcode.org/license.txt for BSD license. USING: alien assocs continuations destructors kernel -namespaces accessors sets ; +namespaces accessors sets summary ; IN: libc ERROR: bad-ptr ; +M: bad-ptr summary + drop "Memory allocation failed" ; + : check-ptr ( c-ptr -- c-ptr ) [ bad-ptr ] unless* ; ERROR: double-free ; +M: double-free summary + drop "Free failed since memory is not allocated" ; + ERROR: realloc-error ptr size ; +M: realloc-error summary + drop "Memory reallocation failed" ; + add-quot-responder - "resource:basis/http/test" >>default + "resource:extra/http/test" >>default main-responder set test-httpd