[MLton-user] experimental release 20051109

Wesley W. Terpstra wesley@terpstra.ca
Tue, 15 Nov 2005 14:13:12 +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.

This seems pretty easy, actually! :-)
Run 'nm -ap' against a binary compiled with '-g'.

You will see the offset in the text segment on the left,
followed by a 'SLINE' directive whose immediately
preceding number is the line number of the last SO.

How hard it is to replicate this 'nm' functionality, I
don't know yet.