🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sys.mac.programmer.codewarrior
2 messages
2 total messages Started by Wade Williams Fri, 08 Mar 2002 22:15
App crashes on object declaration
#1058
Author: Wade Williams
Date: Fri, 08 Mar 2002 22:15
59 lines
3610 bytes
I've got an application which uses a carbonized GUSI.  When the app
makes a simple call to fopen(), which GUSI overrides, the app crashes
on an object declaration.  (Note that under Classic I've used GUSI in
this project fine, and the author of the Carbon version of GUSI uses it
without problem)

The error occurs when it's attempting to create an instance of
GUSIErrorSaver.  It does not actually enter the constructor.

// The next calls also need the services of [[GUSIDeviceRegistry]].
[[open]] used
// both the [[GUSIDeviceRegistry]] and the [[GUSIDescriptorTable]].
//
// <POSIX function wrappers>=
int   open(const char * path, int mode, ...)
{
   GUSIErrorSaver       saveError;    <<-----error occurs right here
   GUSIDeviceRegistry * factory  = GUSIDeviceRegistry::Instance();
   GUSIDescriptorTable *   table = GUSIDescriptorTable::Instance();
   GUSISocket *         sock;
   int                  fd;

and here it is in mixed source / assembly:

{
004EFC60: 7C0802A6  mflr     r0
004EFC64: BEA1FFD4  stmw     r21,-44(SP)
004EFC68: 90010008  stw      r0,8(SP)
004EFC6C: 9421FF90  stwu     SP,-112(SP)
004EFC70: 90610088  stw      r3,136(SP)
004EFC74: 9081008C  stw      r4,140(SP)
004EFC78: 90A10090  stw      r5,144(SP)
004EFC7C: 90C10094  stw      r6,148(SP)
004EFC80: 90E10098  stw      r7,152(SP)
004EFC84: 9101009C  stw      r8,156(SP)
004EFC88: 912100A0  stw      r9,160(SP)
004EFC8C: 914100A4  stw      r10,164(SP)
004EFC90: 3BC26C74  addi     r30,RTOC,27764
004EFC94: 83E287B8  lwz      r31,-30792(RTOC)
   GUSIErrorSaver       saveError;
004EFC98: 801F0000  lwz      r0,0(r31)  <--error occurs here - r31 ==
0x00000000

I don't see anything wrong with the GUSIErrorSaver class definition
(it's very simple), so I'm not sure where the error is coming from.

It was suggested to me that it might be a problem with my runtime, but
I use MSL_All_Carbon_D.Lib (and of course CarbonLib), which is what is
in the stationary.

I have been unable to recreate the error in a smaller project, so I
agree with the theory that it might be something wrong with my linking,
runtime, etc.

Has anyone seen similar errors before?  Any thoughts?

Thanks,

Wade
Re: App crashes on object declaration
#1059
Author: meeroh
Date: Sat, 09 Mar 2002 05:21
56 lines
3008 bytes
In article <080320021615353314%wadesworld@mac.com>,
 Wade Williams <wadesworld@mac.com> wrote:

>I've got an application which uses a carbonized GUSI.  When the app
>makes a simple call to fopen(), which GUSI overrides, the app crashes
>on an object declaration.  (Note that under Classic I've used GUSI in
>this project fine, and the author of the Carbon version of GUSI uses it
>without problem)
>
>The error occurs when it's attempting to create an instance of
>GUSIErrorSaver.  It does not actually enter the constructor.
>
>// The next calls also need the services of [[GUSIDeviceRegistry]].
>[[open]] used
>// both the [[GUSIDeviceRegistry]] and the [[GUSIDescriptorTable]].
>//
>// <POSIX function wrappers>=
>int   open(const char * path, int mode, ...)
>{
>   GUSIErrorSaver       saveError;    <<-----error occurs right here
>   GUSIDeviceRegistry * factory  = GUSIDeviceRegistry::Instance();
>   GUSIDescriptorTable *   table = GUSIDescriptorTable::Instance();
>   GUSISocket *         sock;
>   int                  fd;
>
>and here it is in mixed source / assembly:
>
>{
>004EFC60: 7C0802A6  mflr     r0
>004EFC64: BEA1FFD4  stmw     r21,-44(SP)
>004EFC68: 90010008  stw      r0,8(SP)
>004EFC6C: 9421FF90  stwu     SP,-112(SP)
>004EFC70: 90610088  stw      r3,136(SP)
>004EFC74: 9081008C  stw      r4,140(SP)
>004EFC78: 90A10090  stw      r5,144(SP)
>004EFC7C: 90C10094  stw      r6,148(SP)
>004EFC80: 90E10098  stw      r7,152(SP)
>004EFC84: 9101009C  stw      r8,156(SP)
>004EFC88: 912100A0  stw      r9,160(SP)
>004EFC8C: 914100A4  stw      r10,164(SP)
>004EFC90: 3BC26C74  addi     r30,RTOC,27764
>004EFC94: 83E287B8  lwz      r31,-30792(RTOC)
>   GUSIErrorSaver       saveError;
>004EFC98: 801F0000  lwz      r0,0(r31)  <--error occurs here - r31 ==
>0x00000000

From what I see here it seems that the ctor is inlined or you have  
other optimizations on. You should try turning off all optimizations and 
inlining to see whether that makes it clearer what line of code you are 
crashing on.

hth

meeroh
-- 
Hire me: <http://meeroh.org/hire.html>
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads