[MLton] fixing -codegen c -profile time for the release

Wesley W. Terpstra wesley@terpstra.ca
Wed, 16 Nov 2005 13:10:13 +0100

On Nov 16, 2005, at 5:47 AM, Stephen Weeks wrote:
> Wesley proposed an approach based on debugging formats and
> interpreting them at runtime (or perhaps mlprof time).

Yes, and I have it working for me on PPC now
(but only on PPC). I couldn't use the macro to do
it, so had to modify the c-codegen.fun.

> ... it makes us more intimately
> tied with messy details of other systems and hence less portable.

This is definitely true. For example, I told Matthew to try
'nm -ap' and described the output I see on Tiger, which
does not look the same as on linux. The file formats of
the executable are definitely different, even though the
format of the stabs debug info itself is not. Furthermore,
you can't rely on tools like 'nm' to decode it uniformly.

I did look around for a library that does this cross-platform,
but didn't have any luck.

> It may make sense [...] for use in debugging ...

However, that is about outputting stabs information,
which is portable. Finding/parsing the stabs info from
a binary is an orthogonal problem. So, I don't think
using stabs for profiling will help with debugging.

Actually, the opposite is probably true since the way
my approach works is by stuffing bogus file/line debug
info into the binary. This means a given binary couldn't
be both profiled and debugged at the same time.