[Prev][Next][Index][Thread]

Re: d2c on Macintosh (help!)



> From: "Gabor Greif" <gabor@no.netopia.com>
> 
> Hi Rob,
> 
> I assume this is a PowerPC problem and that bootstrapping in 68k emulation
> is too slow to be tried (it sometimes helps to switch architectures if
> strange things happen). Also I think you use Macsbug 6.6.

I could try a 68k version. I'd rather not, though, as I've been working on
PPC.
Yes, I'm using Macsbug 6.6. The cursor support is nice. :-)

> 1) I usually have such hard crashes if the stack expands into the heap. You
> can guard against this if you put some ppc watchpoints in the area behind
> the gd heap zone. Or you can write some patter here and check it for
> integrity from a frequently invoked routine. If this is the cause then
> SetApplLimit is your friend.

I'm unfamiliar with watchpoints, although the MacsBug help explains these
well enough for me to start using them. What exactly do you mean by the area
"behind" the gd heap zone? In the system heap or the QDGlobals area or just
below the end of the stack or somewhere else?

> 2) If you use trampolines with dynamically generated machine code
> (shouldn't be necessary on ppc bacause of TVectors) then do not forget to
> correctly invalidate the instruction cache for the block(s) the trampolines
> will go into. Though, this does not usually corrupt the heap zone.

I'm using trampolines that print out an error then die. :-) They don't seem
to get called, to my relief. I can flag blocks executable and flush the
cache if needed. I'll look into TVectors, can you give me any pointers to
documentation?

> 3) From CW or Macsbug set watchpoints onto the zone header. This may stop
> your program just when the corruption occurs.

This is what I need, as after the header gets scribbled it's a bit like the
opening of "Mostly Harmless" (the error handling system isn't there to
handle the error and the system that would ask it to and do something about
it isn't there either....).

> Hope this helps and thanks for your efforts bringing gd to the Mac!

This definitely helps. Thank you!

- Rob.

> PS: Do you directly feed the output of gd into the CW C compiler plugin? If
> you plan to do so, drop me a note, I did this earlier with a toy project
> (68k based plugin but ppc based should be similar) with nice results.

This would be good, although the compiled results will need to be linked to
the runtime lib so I was thinking I'd need to generate a project (possibly
in XML :-) ). Please let me know how you did this, I'd appreciate it.




Follow-Ups: References: