[gambit-list] Fatal crash

Marc Feeley feeley at iro.umontreal.ca
Fri Apr 11 20:03:00 EDT 2008


On 11-Apr-08, at 11:31 AM, François Magnan wrote:
> Hi,
>
> I found a specific bug in Gambit-C 4.2.5 that crashes with a "bus
> error".
>
> Here is the code to repoduce it:
>
> (define (crash)
>   (with-exception-handler
>        (lambda (e)
> 	 (display (compute-error-message e))
> 	 (force-output))
>        (lambda ()
> 	 (+ 1 a))))
>
>
>
> (define (compute-error-message e)
>   (##continuation-capture
>    (lambda (k)
>      (string-append
>       (call-with-output-string ""
> 			       (lambda (p)
> 				 (##display-exception-in-context e k p)))
>       "\n\n"
>       (call-with-output-string ""
> 			       (lambda (p)
> 				 (##cmd-b 0 k p)))))))
>
> It used to work before. The function (compute-error-message e) is used
> to get a verbose error message when my program crashes since it can
> happen in any concurrent thread.
>
> Is the ##cmd still supported?


The API for ##cmd-b changed.  You do not need to call these unsafe  
"##" procedures anymore because the functionality has been exposed  
with safe (type checking) procedures.  Here's what you should do:

(define (compute-error-message e)
   (continuation-capture
    (lambda (k)
      (string-append
       (call-with-output-string ""
         (lambda (p)
           (display-exception-in-context e k p)))
       "\n\n"
       (call-with-output-string ""
         (lambda (p)
           (display-continuation-backtrace k p)))))))

Marc




More information about the Gambit-list mailing list