# SDL error messages are not helpful...



## iceman.mji (Nov 26, 2003)

A friend and I are programming a game engine, we are doing it in C++ using SDL and OpenGL.  He has it running and performing well on his PC and I have been trying to get it running on my Mac.  It compiles fine, has a few warnings but no errors, and it opens up a window but then it exits out and I get the following error:

_Fatal signal: Bus Error (SDL Parachute Deployed)

Engine has exited with status 246._

I am using ProjectBuilder, by the way, I haven't got around to getting 10.3 yet....  This has got to be the most useless error I have ever seen, other than not getting one at all.  Does anyone know what this means or where I can find out what to do to solve this problem?  Thank you for any help you can give me.

~Matt


----------



## rhg (Nov 26, 2003)

Should be easy: Just run it in the debugger, it should halt on the error and show you the offending source code line (presumed you compiled it with debug symbols enabled).


----------



## iceman.mji (Nov 26, 2003)

Yes but for some reason when I set a breakpoint for the debugger at the first line of the main function it says "Debugging of Engine ended normally" in the lower left corner of the status bar at the bottom of the debug widow.  And it says this without letting me debug anything...  (Probably should have mentioned this in my original post)  This could just be my not knowing how to use ProjectBuilder well enough or something but I found it rather strange that it seemingly ignored my breakpoints.  So I guess my question this time is how do I get the breakpoints to be recognized by ProjectBuilder's debugger?


----------



## wadesworld (Nov 26, 2003)

If you run the app outside of Project Builder, you should have a stack trace pop up on your screen when the app crashes.  Post that here and we'll have some clues.

(If you haven't enabled CrashReporter functionality, you need to do so in order to get the stack trace popping up.  Go into your Console.app, go under preferences and turn on both options under the crashes tab.)

Wade


----------



## rhg (Nov 27, 2003)

iceman.mji said:
			
		

> Yes but for some reason when I set a breakpoint for the debugger at the first line of the main function it says "Debugging of Engine ended normally" in the lower left corner of the status bar at the bottom of the debug widow.



In this case the debugger most likely is unable to locate some shared library - this is at least what I often experience. The debugger has a console window which you can bring into view, this will show you detailed messages during startup of your program. You will probably see a message that a library could not be loaded, pointing out in which directory the debugger has looked for it. Change to this directory and create a symlink to the library in question, this should solve the problem.


----------



## iceman.mji (Dec 2, 2003)

This is a reply to a couple of my responses.  Which have been productive so far so thank you for that.  I warn you that this is a rather long post of error messages.

Here is the console output from the dubugger:

_GNU gdb 5.3-20021014 (Apple version gdb-250) (Sat Dec  7 02:14:27 GMT 2002)
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "powerpc-apple-macos10".
run
tty /dev/ttyp1
warning: Unable to read symbols from "@executable_path/../Frameworks/SDL.framework/Versions/A/SDL"; reading from memory.
/SourceCache/gdb/gdb-250/src/gdb/macosx/macosx-nat-dyld-process.c:505: internal-error: assertion failure in function "dyld_load_library": e->dyld_valid

A problem internal to GDB has been detected.  Further
debugging may prove unreliable.

The Debugger has exited due to signal 6 (SIGABRT)._

And here is the output to the MacOS X console after turning on crash reports:

_**********

Date/Time:  2003-12-01 22:53:22 -0800
OS Version: 10.2.8 (Build 6R73)

Command:    Engine
PID:        3108

Exception:  EXC_BAD_ACCESS (0x0001)
Codes:      KERN_PROTECTION_FAILURE (0x0002) at 0x00000020

Thread 0 Crashed:
 #0   0x00005404 in Exception::Exception[unified](char*, char*) (Main.cpp:38)
 #1   0x0000537c in Exception::Exception[in-charge](char*, char*) (Main.cpp:45)
 #2   0x0000ca88 in ENE::ImportENE(char*, Object&) (Main.cpp:23)
 #3   0x0000f184 in Object::Object[unified](char*) (Main.cpp:50)
 #4   0x0000f0e8 in Object::Object[in-charge](char*) (Main.cpp:51)
 #5   0x0001db48 in GameINIT(Screen*, int, char**) (Main.cpp:49)
 #6   0x0001e1ec in SDL_main (Main.cpp:31)
 #7   0x00004dd8 in -[SDLMain applicationDidFinishLaunching:] (SDLMain.m:196)
 #8   0x97dfab58 in _nsNotificationCenterCallBack
 #9   0x901684d0 in _postNotification
 #10  0x90165be4 in _CFNotificationCenterPostLocalNotification
 #11  0x9318a720 in -[NSApplication _sendFinishLaunchingNotification]
 #12  0x93161624 in _requiredAEEventHandler
 #13  0x91b56570 in aeDispatchAppleEvent(AEDesc const*, AEDesc*, unsigned long, unsigned char*)
 #14  0x91b590cc in dispatchEventAndSendReply(AEDesc const*, AEDesc*)
 #15  0x91b56478 in aeProcessAppleEvent
 #16  0x96a83778 in AEProcessAppleEvent
 #17  0x9308e0a8 in _DPSNextEvent
 #18  0x930a0158 in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]
 #19  0x930b1d88 in -[NSApplication run]
 #20  0x00004d2c in CustomApplicationMain (SDLMain.m:176)
 #21  0x00005124 in main (SDLMain.m:277)
 #22  0x00004444 in _start (crt.c:267)
 #23  0x000042c4 in start

Thread 1:
 #0   0x90073ba8 in mach_msg_trap
 #1   0x90005ed0 in mach_msg
 #2   0xc0009528 in __ape_internal
 #3   0xc0001368 in __ape_agent
 #4   0x90020c28 in _pthread_body

PPC Thread State:
  srr0: 0x00005404 srr1: 0x0000f930                vrsave: 0x00000000
   xer: 0x00000000   lr: 0x000053c8  ctr: 0x90000e40   mq: 0x00000000
    r0: 0x00000045   r1: 0xbfffe230   r2: 0x24004280   r3: 0x00000018
    r4: 0x80808080   r5: 0x00000000   r6: 0x80808080   r7: 0x00000000
    r8: 0x00000000   r9: 0x000463d8  r10: 0x00000020  r11: 0x00000000
   r12: 0x90000e40  r13: 0x00000000  r14: 0x00000000  r15: 0x00000000
   r16: 0x00000000  r17: 0x00000000  r18: 0x00000002  r19: 0x00000000
   r20: 0x00148e10  r21: 0x0d9a1072  r22: 0xa3075950  r23: 0xbffff090
   r24: 0xa3075950  r25: 0x00148e10  r26: 0x00000000  r27: 0xbffff0ac
   r28: 0x00148e10  r29: 0xa3075950  r30: 0xbfffe230  r31: 0x97dfaad4
_

I have tried a few things to get the debugger to work none have been affective so far, I have a few other things to try before I am out of ideas though.  As far as the MacOS X console error goes it seems that the program is trying to access things it should not be.  Well I'm off to try to fix it again, thank you in advance for any help you guys can give me.


----------



## wadesworld (Dec 2, 2003)

Several clues there:


```
warning: Unable to read symbols from "@executable_path/../Frameworks/SDL.framework/Versions/A/SDL"; reading from memory.
```

This likely means the version of SDL you have installed in the Frameworks folder of your app's bundle was not compiled with debugging support.  That's not a big deal, but I generally try to have both a debug and deployment build - the debug version includes the debug version of the framework.


```
/SourceCache/gdb/gdb-250/src/gdb/macosx/macosx-nat-dyld-process.c:505: internal-error: assertion failure in function "dyld_load_library": e->dyld_valid
```

It looks like the debugger is crashing while trying to load SDL.


```
#2 0x0000ca88 in ENE::ImportENE(char*, Object&) (Main.cpp:23)
```

This is the function that's causing the problem.  See if you can figure out what it does, or ask the SDL maintainers.

Wade


----------

