That's exactly what I needed. Is breakEx documented anywhere? Also, is
there any way to break on a parameterised exception, regardless of
parameters?

Either way, I managed to get ahold of the exact exception (with
params) like this:

exception foo;
val exp = (use "bug.ML"; foo) handle e => e;
PolyML.Debug.breakEx exp;
use "bug.ML";

Very cool.

On 25 September 2011 17:29, David Matthews
<[email protected]> wrote:
> PolyML.exception_trace only shows the functions that have separate pieces of
> code.  Small functions are inlined by the compiler and won't show up.  You
> can override this by setting PolyML.Compiler.maxInlineSize to something
> small e.g. zero.
>
> Alternatively, you can use the debugger to find the cause of the exception.
>  Set PolyML.Compiler.debug to true before compiling the code and then set a
> trap for the exception with
> PolyML.Debug.breakEx test_exp;
> It will stop at the exit of the function that raised the exception and you
> can examine the stack and local variables.  Compiling with debugging turned
> on greatly increases run time so it may not always be feasible but will
> usually help you find the problem.
>
> Regards,
> David
>
> On 24/09/2011 17:09, Aleks Kissinger wrote:
>>
>> Howdy,
>>
>> I'm trying to track down a bug, but PolyML.exception_trace doesn't
>> seem to be working right. See the following example.
>>
>> % test_exp.ML
>> exception test_exp;
>> fun f () = raise test_exp;
>> fun g () = (2 + (f ()));
>> fun h () = 2 * (g ());
>>
>>
>> bash>  poly --use test_exp.ML
>>
>> Poly/ML 5.4.2 Testing
>> exception test_exp
>> val f = fn: unit ->  'a
>> val g = fn: unit ->  int
>> val h = fn: unit ->  int
>>>
>>> h ();
>>
>> Exception- test_exp raised
>>>
>>> PolyML.exception_trace h;
>>
>> Exception trace for exception - test_exp raised in test_stuff.ML line 2
>>
>> End of trace
>>
>> Exception- test_exp raised
>>>
>>
>> I'm using the latest Poly/ML SVN version.
>>
>> a
>> _______________________________________________
>> polyml mailing list
>> [email protected]
>> http://lists.inf.ed.ac.uk/mailman/listinfo/polyml
>
> _______________________________________________
> polyml mailing list
> [email protected]
> http://lists.inf.ed.ac.uk/mailman/listinfo/polyml
>
_______________________________________________
polyml mailing list
[email protected]
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

Reply via email to