[kaffe] printing to a file in kaffe
robilad at kaffe.org
Tue Aug 24 03:27:45 PDT 2004
> I'm actually trying to profile kaffe. In this process, I'm printing some arguments to a file.
> Say for example If I have a function called gcmalloc in kaffe, I put a hook as follows:
> extern FILE *outfp; //outfp points to my trace file
> fprintf(outfp,"%p %d\n",mem,sz);
> I expect the trace file to be in a fixed format something like this:
> 0x1234 22
> 0x2345 34
> But I see something like
> 0x1234 220x2345 34
> I used fflush(outfp) but I really cannot print something to a file in the format that I want.
> The format is really important for my analysis. Can anyone please help me with this and let me know how to print to a file in the format that I want in kaffe.
your problem may be caused by different threads calling your function at
the same time. Try using dprintf, like other debugging output does.
Looking at kaffe/kaffevm/kaffe-gc/gcmem.c, it seems like that sort of
output (size and location of allocated blocks in the gc) is already
printed by -vmdebug GCALLOC. You have to enable debugging in configure,
though. And you'd have to deal with a slightly different output format.
best of luck for your work,
More information about the kaffe