[plt-scheme] Getting stack traces

From: Guillaume Marceau (gmarceau at cs.brown.edu)
Date: Mon Mar 17 12:26:27 EST 2003

Hello list,

I am writing a type checker for DrScheme. I am packaging it as a tool,
just like the current Syntax Checker. That mean I am loading it
throught the PLTCOLLECTS environment variable and I have a spiffy
button on DrScheme's toolbar.

Unfortunatly, if I make a mistake and DrScheme crashes while running my
type checking code, I get very little information about the crash. For
instance, I just fixed the following mistake:

  (define (fn-type? typ) 
    (and (list typ)  ;;;;   <---  missing "?" !
         (eq? (first typ) '->)))
When running, it looks like :

  # /home/gmarceau/collects/type-checker/ > drscheme ass2.ss
     < The DrScheme's windows comes up, and I click on the button >
  Begin traversal... 
  first: expects argument of type <non-empty list>; given v1

Without a line number for the crash, I had to binary search down my code
using calls to display. Certainly less than optimal.

I tried loading errortrace.ss :

  (module unifier mzscheme
    (require "base-gm.ss"
             (lib "errortrace.ss" "errortrace"))

Yes that did not seem to work. I've read throught
collects/errortrace/doc.txt, but I could not find what I am doing
wrong (if anything). I'm using 'expand-program' to walk throught the ast
of the text of the current the program window. Maybe that has something to
do with the problem.

I figured if I could start a DrScheme within DrScheme, and click on my
Type Check button in the embeeded DrScheme, the first DrScheme would give
me a clickable stack trace. Does anyone know how to do that?

  "In Google non est, ergo non est." 

- Guillaume

Posted on the users mailing list.