[MLton-devel] Profiling under FreeBSD?

jlouis@diku.dk jlouis@diku.dk
Sun, 22 Sep 2002 13:40:24 +0200


On Sat, Sep 21, 2002 at 06:09:41PM -0700, Stephen Weeks wrote:
> 
> > Is the profiling working under FreeBSD yet. I bootstrapped the compiler
> > from smlnj, but when I try to do profiles I get a lot of undefined
> > symbols in the linker phase:
> 
> Profiling is not working on FreeBSD.  I see that all of
> runtime/basis/MLton/profile.c is in an #if (defined (__linux__)).  It may be
> as simple a matter as adding || defined (__FreeBSD__), but I don't
> know.  You can try it if you want.  I'll have a look later this
> weekend.

Done. Only problem was the ucontext_t which is defined in another way. I
put in an #if defined... to solve it. Patch follows.

sarah% c diff profile.c             
cvs diff: failed to open /home/jlouis/.cvspass for reading: No such file or dire
ctory
Index: profile.c
===================================================================
RCS file: /cvsroot/mlton/mlton/runtime/basis/MLton/profile.c,v
retrieving revision 1.3
diff -u -r1.3 profile.c
--- profile.c   24 Feb 2002 04:48:29 -0000      1.3
+++ profile.c   22 Sep 2002 11:35:18 -0000
@@ -1,4 +1,4 @@
-#if (defined (__linux__))
+#if (defined (__linux__) || defined (__FreeBSD__))
 #include <signal.h>
 #include <errno.h>
 #include <string.h>
@@ -114,7 +114,11 @@
 {
        uint    pc;
 
+#if (defined (__linux__))
        pc = ucp->uc_mcontext.gregs[EIP];
+#elif (defined (__FreeBSD__))
+       pc = ucp->uc_mcontext.mc_eip;
+#endif
        if (((uint)&_start <= pc) and (pc <= (uint)&etext))
                ++current[pc - (uint)&_start + 1];
        else

-- 
Jesper
 To iterate is human, to recurse divine - Robert Heller


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
MLton-devel mailing list
MLton-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlton-devel