[MLton] debugging (was: experimental release)

Wesley W. Terpstra wesley@terpstra.ca
Tue, 15 Nov 2005 14:10:32 +0100

On Nov 15, 2005, at 10:30 AM, Wesley W. Terpstra wrote:
> Can't we take a page from cpp, ie: put directives
> into the C source that specify the profile label?
> #define ProfileLabel(l) # l "/tmp/magic-mlton-profile-label.sml"
> If the files were compiled with '-g', you'd have debug
> information which told you the 'line number', which
> in this case would be the ProfileLabel. I don't know
> how hard/portable reading debug info is, though.

I've been reading how the stabs debug format works at:

... and it sounds ... sane!

In fact, after reading the documentation, I think it is quite
feasible to make gdb work with mlton generated binaries.
... by work I also mean that it can read values.
... there might be problems with the MLton stack, though.

gdb is getting a description of how the types are laid out
as part of the stabs data, so it should be possible to output
even ML's data types, if the layout information is available.

This sort of output is easiest done in the x86 codegen, but
it might be possible to do in the C codegen too, using
asm directives.