[MLton-user] Unsafe mode? Incantation to disablle array bounds
checks.
Matthew Fluet
fluet at tti-c.org
Wed Oct 31 19:47:13 PST 2007
On Wed, 31 Oct 2007, Ryan Newton wrote:
> Overflows are certainly the exceptions that I run into the most. I use
> -const 'Exn.keepHistory true' to get a stack trace when the exception occurs.
> Unfortunately, since this is generated code we're dealing with, just knowing
> what "function" the exception came from doesn't help that much -- it's
> generally a fairly large block of code. Is there some more expensive debug
> mode to go into that would track source information at a finer granularity?
The exception history mechanism piggybacks on the profiling mechanism.
So, any of the profiling options that adjust the granularity of profiling
will also adjust the granularity of exception history. The following
would likely be helpful in your case:
-profile-branch {false|true} profile branches in addition to functions
-profile-val {false|true} profile val bindings in addition to functions
The former will include call-stack entries for case branches, while the
latter will include call-stack entries for (expansive) val bindings. So,
you will get exception histories like:
r.<raise> z.sml 7.45
r.<case NONE> z.sml 7.39
r.<val i> z.sml 6.27
r.<case ()> z.sml 4.21
r z.sml 4.12
<val z> z.sml 15.12
<main>
In this case, the most useful information is not only that the function r
raised an exception, but that it is the invocation of r from the right
hand side of the the top-level binding of z that raised the exception.
> Again, I seem to be particularly bad at googling when it comes to things
> MLton. I've googled for everything I can think of with "mlton" and
> "debugging" but I never seem to find this stuff.
The "search" box on the mlton.org website does a google search, but limits
it to the mlton.org domain, which includes all the mailing list archives.
That can be useful.
But, in any case, the mailing lists are here to answer questions.
More information about the MLton-user
mailing list