From Nicolas.Bertolotti at mathworks.fr Thu Dec 11 09:18:50 2008 From: Nicolas.Bertolotti at mathworks.fr (Nicolas Bertolotti) Date: Thu Dec 11 09:19:30 2008 Subject: [MLton] MLton bug: unhandled exception in Basis Library. Message-ID: <8320D98DA9A5C54C926D397795FE7CEA385AFC2CFC@EXCHANGE-UK.ad.mathworks.com> Skipped content of type multipart/alternative-------------- next part -------------- A non-text attachment was scrubbed... Name: image002.jpg Type: image/jpeg Size: 2747 bytes Desc: image002.jpg Url : http://mlton.org/pipermail/mlton/attachments/20081211/6df2629a/image002.jpg From vesa.a.j.k at gmail.com Fri Dec 12 05:44:21 2008 From: vesa.a.j.k at gmail.com (Vesa Karvonen) Date: Fri Dec 12 05:44:23 2008 Subject: [MLton] MLton bug: unhandled exception in Basis Library. In-Reply-To: <8320D98DA9A5C54C926D397795FE7CEA385AFC2CFC@EXCHANGE-UK.ad.mathworks.com> References: <8320D98DA9A5C54C926D397795FE7CEA385AFC2CFC@EXCHANGE-UK.ad.mathworks.com> Message-ID: <9e43b9a0812120544k4031f09ew5a1934b23438f503@mail.gmail.com> On Thu, Dec 11, 2008 at 7:18 PM, Nicolas Bertolotti wrote: [...] > I am now trying to identify the call that raises this error but I can not > figure how to retrieve and print the exception history. The following post might be helpful: http://mlton.org/pipermail/mlton/2006-December/029466.html . As this is at least the second time this issue has shown up, it might be useful to add this to the FAQ (http://mlton.org/FAQ). -Vesa Karvonen From Nicolas.Bertolotti at mathworks.fr Mon Dec 15 04:20:37 2008 From: Nicolas.Bertolotti at mathworks.fr (Nicolas Bertolotti) Date: Mon Dec 15 04:21:18 2008 Subject: [MLton] MLton bug: unhandled exception in Basis Library. In-Reply-To: <9e43b9a0812120544k4031f09ew5a1934b23438f503@mail.gmail.com> References: <8320D98DA9A5C54C926D397795FE7CEA385AFC2CFC@EXCHANGE-UK.ad.mathworks.com> <9e43b9a0812120544k4031f09ew5a1934b23438f503@mail.gmail.com> Message-ID: <8320D98DA9A5C54C926D397795FE7CEA385AFC3091@EXCHANGE-UK.ad.mathworks.com> Not really what I am looking for... (I already know how to use the exception history) The problem here is that the exception occurs at program startup during the initialisation of the basis library. At this stage, there is no real way to catch the exception and print the history. > -----Original Message----- > From: Vesa Karvonen [mailto:vesa.a.j.k@gmail.com] > Sent: Friday, December 12, 2008 2:44 PM > To: Nicolas Bertolotti > Cc: mlton@mlton.org > Subject: Re: [MLton] MLton bug: unhandled exception in Basis Library. > > On Thu, Dec 11, 2008 at 7:18 PM, Nicolas Bertolotti > wrote: > [...] > > I am now trying to identify the call that raises this error but I can > not > > figure how to retrieve and print the exception history. > > The following post might be helpful: > http://mlton.org/pipermail/mlton/2006-December/029466.html . As this > is at least the second time this issue has shown up, it might be > useful to add this to the FAQ (http://mlton.org/FAQ). > > -Vesa Karvonen From fluet at tti-c.org Tue Dec 16 08:37:38 2008 From: fluet at tti-c.org (Matthew Fluet) Date: Tue Dec 16 08:39:55 2008 Subject: [MLton] MLton bug: unhandled exception in Basis Library. In-Reply-To: <8320D98DA9A5C54C926D397795FE7CEA385AFC3091@EXCHANGE-UK.ad.mathworks.com> References: <8320D98DA9A5C54C926D397795FE7CEA385AFC2CFC@EXCHANGE-UK.ad.mathworks.com> <9e43b9a0812120544k4031f09ew5a1934b23438f503@mail.gmail.com> <8320D98DA9A5C54C926D397795FE7CEA385AFC3091@EXCHANGE-UK.ad.mathworks.com> Message-ID: On Mon, 15 Dec 2008, Nicolas Bertolotti wrote: > Not really what I am looking for... (I already know how to use the exception history) > > The problem here is that the exception occurs at program startup during the initialisation of the basis library. > > At this stage, there is no real way to catch the exception and print the history. The "fancy" top-level exception handler, that prints the history, is implemented in /basis-library/primitive/mlton/exn.sml and "installed" by 'Primitive.TopLevel.setHandler' in /basis-library/primitive/mlton/mlton.sml An unhandled exception that is raised during the evaluation of the Basis Library before the installation of the "fancy" top-level exception handler is handled by the "emergency" top-level exception handler that is "installed" in /basis-library/primitive/prim2.sml If you want the emergency exception handler to print an exception history, then you need to move (some portion of) the fancy exception handler implementation back to the implementation of the emergency handler. In particular, you need to call 'Primitive.MLton.Exn.setExtendExtra' with a non-trivial function that captures the call-stack and you need to walk the call-stack, extract the entries, and print them. It won't be trivial, since, at the point of definition of the emergency exception handler, you have almost no Basis Library functions available; everything will need to be done with very primitive operations. From henry.cejtin at sbcglobal.net Tue Dec 16 10:10:54 2008 From: henry.cejtin at sbcglobal.net (Henry Cejtin) Date: Tue Dec 16 10:11:26 2008 Subject: [MLton] MLton bug: unhandled exception in Basis Library. Message-ID: <237369.89727.qm@web82405.mail.mud.yahoo.com> Wouldn't it be easy if the emergeny handler just went straight to C code (via the FFI) to print out the history? From fluet at tti-c.org Tue Dec 16 11:26:47 2008 From: fluet at tti-c.org (Matthew Fluet) Date: Tue Dec 16 11:28:42 2008 Subject: [MLton] MLton bug: unhandled exception in Basis Library. In-Reply-To: <237369.89727.qm@web82405.mail.mud.yahoo.com> References: <237369.89727.qm@web82405.mail.mud.yahoo.com> Message-ID: On Tue, 16 Dec 2008, Henry Cejtin wrote: > Wouldn't it be easy if the emergeny handler just went straight to C code > (via the FFI) to print out the history? Good point. Then it would probably suffice to move the implementation of MLton.CallStack.current to /basis-library/prim-mlton.sml, also do the non-trivial setExtendExtra in /basis-library/prim-mlton.sml, and, for the emergency handler, hand off the entire call-stack array to C to look-up and print the source strings.