SIGBUS at startup

Started by
5 comments, last by Sijmen 18 years, 6 months ago
I've written a little test program with XCode on OS X. I've included the SDL.framework framework so that I can use SDL from that program. For testing I kept the main() function emtpy, just return 0. However, when I compile and run I get a 'SIGBUS' error and the program exits. Any idea what could be wrong?
Advertisement
Run it in the debugger so you can see where the signal was raised.
Free Mac Mini (I know, I'm a tool)
I have no previous experience with this debugger, but I started it with the debugger, and this is where it crashed. The line where the debugger pointed at is marked.

0x00002620  &lt;+0156>  addis	r2,r31,00x00002624  &lt;+0160>  lwz	r2,27208(r2)0x00002628  &lt;+0164>  lwz	r12,0(r2)0x0000262c  &lt;+0168>  cmpwi	cr7,r12,00x00002630  &lt;+0172>  beq-	cr7,0x263c <start+184>0x00002634  &lt;+0176>  mtctr	r120x00002638  &lt;+0180>  bctrl0x0000263c  &lt;+0184>  bl	0x84e0 <dyld_stub___keymgr_dwarf2_register_sections>0x00002640  &lt;+0188>  addis	r2,r31,00x00002644  &lt;+0192>  lwz	r12,27192(r2)0x00002648  &lt;+0196>  lwz	r0,0(r12)0x0000264c  &lt;+0200>  cmpwi	cr7,r0,00x00002650  &lt;+0204>  beq+	cr7,0x265c <start+216>0x00002654  &lt;+0208>  mtctr	r120x00002658  &lt;+0212>  bctrl0x0000265c  &lt;+0216>  bl	0x2840 <start+700>0x00002660  &lt;+0220>  bl	0x294c <start+968>0x00002664  &lt;+0224>  addis	r3,r31,00x00002668  &lt;+0228>  addi	r3,r3,250360x0000266c  &lt;+0232>  addi	r4,r1,560x00002670  &lt;+0236>  bl	0x2b60 <start+1500>0x00002674  &lt;+0240>  lwz	r3,56(r1)0x00002678  &lt;+0244>  cmpwi	cr7,r3,00x0000267c  &lt;+0248>  beq-	cr7,0x2684 <start+256>0x00002680  &lt;+0252>  bl	0x8500 <dyld_stub_atexit>0x00002684  &lt;+0256>  li	r0,00x00002688  &lt;+0260>  addis	r2,r31,00x0000268c  &lt;+0264>  lwz	r2,27204(r2)0x00002690  &lt;+0268>  stw	r0,0(r2)0x00002694  &lt;+0272>  lwz	r10,0(r29)0x00002698  &lt;+0276>  cmpwi	cr7,r10,00x0000269c  &lt;+0280>  bne+	cr7,0x2724 <start+416>0x000026a0  &lt;+0284>  b	0x26e8 <start+356>0x000026a4  &lt;+0288>  mr	r11,r20x000026a8  &lt;+0292>  mr	r2,r90x000026ac  &lt;+0296>  cmpwi	cr7,r0,470x000026b0  &lt;+0300>  bne+	cr7,0x26b8 <start+308>0x000026b4  &lt;+0304>  mr	r8,r110x000026b8  &lt;+0308>  lbz	r0,0(r2)0x000026bc  &lt;+0312>  addi	r9,r2,10x000026c0  &lt;+0316>  extsb.	r0,r00x000026c4  &lt;+0320>  bne+	0x26a4 <start+288>0x000026c8  &lt;+0324>  cmpwi	cr7,r8,00x000026cc  &lt;+0328>  beq-	cr7,0x26e0 <start+348>0x000026d0  &lt;+0332>  addi	r0,r8,10x000026d4  &lt;+0336>  addis	r2,r31,00x000026d8  &lt;+0340>  stw	r0,27188(r2)0x000026dc  &lt;+0344>  b	0x26e8 <start+356>0x000026e0  &lt;+0348>  addis	r2,r31,00x000026e4  &lt;+0352>  stw	r10,27188(r2)0x000026e8  &lt;+0356>  lwz	r0,0(r30)0x000026ec  &lt;+0360>  cmpwi	cr7,r0,00x000026f0  &lt;+0364>  bne+	cr7,0x26fc <start+376>0x000026f4  &lt;+0368>  mr	r6,r300x000026f8  &lt;+0372>  b	0x270c <start+392>0x000026fc  &lt;+0376>  mr	r6,r300x00002700  &lt;+0380>  lwzu	r0,4(r6)0x00002704  &lt;+0384>  cmpwi	cr7,r0,00x00002708  &lt;+0388>  bne+	cr7,0x2700 <start+380>0x0000270c  &lt;+0392>  mr	r3,r280x00002710  &lt;+0396>  mr	r4,r290x00002714  &lt;+0400>  mr	r5,r300x00002718  &lt;+0404>  addi	r6,r6,40x0000271c  &lt;+0408>  bl	0x2ed4 <__darwin_gcc3_preregister_frame_info+220>0x00002720  &lt;+0412>  bl	0x84c0 <dyld_stub_exit>    <== CRASH LINE0x00002724  &lt;+0416>  lbz	r0,0(r10)0x00002728  &lt;+0420>  extsb.	r0,r00x0000272c  &lt;+0424>  beq-	0x26e0 <start+348>0x00002730  &lt;+0428>  addi	r2,r10,10x00002734  &lt;+0432>  mr	r11,r100x00002738  &lt;+0436>  li	r8,00x0000273c  &lt;+0440>  b	0x26ac <start+296>0x00002740  &lt;+0444>  mflr	r00x00002744  &lt;+0448>  bcl-	20,4*cr7+so,0x2748 <start+452>0x00002748  &lt;+0452>  mflr	r120x0000274c  &lt;+0456>  addis	r12,r12,00x00002750  &lt;+0460>  mtlr	r00x00002754  &lt;+0464>  addi	r12,r12,239280x00002758  &lt;+0468>  mtctr	r120x0000275c  &lt;+0472>  bctr0x00002760  &lt;+0476>  mflr	r00x00002764  &lt;+0480>  bcl-	20,4*cr7+so,0x2768 <start+484>0x00002768  &lt;+0484>  mflr	r120x0000276c  &lt;+0488>  addis	r12,r12,00x00002770  &lt;+0492>  mtlr	r00x00002774  &lt;+0496>  addi	r12,r12,19000x00002778  &lt;+0500>  mtctr	r120x0000277c  &lt;+0504>  bctr0x00002780  &lt;+0508>  mflr	r00x00002784  &lt;+0512>  bcl-	20,4*cr7+so,0x2788 <start+516>0x00002788  &lt;+0516>  mflr	r120x0000278c  &lt;+0520>  addis	r12,r12,00x00002790  &lt;+0524>  mtlr	r00x00002794  &lt;+0528>  addi	r12,r12,239280x00002798  &lt;+0532>  mtctr	r120x0000279c  &lt;+0536>  bctr0x000027a0  &lt;+0540>  mflr	r00x000027a4  &lt;+0544>  bcl-	20,4*cr7+so,0x27a8 <start+548>0x000027a8  &lt;+0548>  mflr	r120x000027ac  &lt;+0552>  addis	r12,r12,00x000027b0  &lt;+0556>  mtlr	r00x000027b4  &lt;+0560>  addi	r12,r12,9520x000027b8  &lt;+0564>  mtctr	r120x000027bc  &lt;+0568>  bctr0x000027c0  &lt;+0572>  mflr	r00x000027c4  &lt;+0576>  bcl-	20,4*cr7+so,0x27c8 <start+580>0x000027c8  &lt;+0580>  mflr	r120x000027cc  &lt;+0584>  addis	r12,r12,00x000027d0  &lt;+0588>  mtlr	r00x000027d4  &lt;+0592>  addi	r12,r12,3880x000027d8  &lt;+0596>  mtctr	r120x000027dc  &lt;+0600>  bctr0x000027e0  &lt;+0604>  mflr	r00x000027e4  &lt;+0608>  bcl-	20,4*cr7+so,0x27e8 <start+612>0x000027e8  &lt;+0612>  mflr	r120x000027ec  &lt;+0616>  addis	r12,r12,00x000027f0  &lt;+0620>  mtlr	r00x000027f4  &lt;+0624>  addi	r12,r12,880x000027f8  &lt;+0628>  mtctr	r120x000027fc  &lt;+0632>  bctr0x00002800  &lt;+0636>  mflr	r00x00002804  &lt;+0640>  bcl-	20,4*cr7+so,0x2808 <start+644>0x00002808  &lt;+0644>  mflr	r120x0000280c  &lt;+0648>  addis	r12,r12,00x00002810  &lt;+0652>  mtlr	r00x00002814  &lt;+0656>  addi	r12,r12,237680x00002818  &lt;+0660>  mtctr	r120x0000281c  &lt;+0664>  bctr


Any idea what could be wrong? Note that this program is nothing but two unused classes, a main function with return 0, linked with SDL.
SDl for mac requires you add the files SDL_main.h and SDL_main.m to your project - did you do it? in XCode to create a SDl project i just suggest you use file -> new project -> SDl applciation. sdl should have installed a XCode template on your computer - i recommand you use it!

good luck
Quote:Original post by Marianne
SDl for mac requires you add the files SDL_main.h and SDL_main.m to your project - did you do it? in XCode to create a SDl project i just suggest you use file -> new project -> SDl applciation. sdl should have installed a XCode template on your computer - i recommand you use it!

good luck


Now you say so, that template is there, including those files.

I wonder though, I'm using C++ - not Objective C. Why can't it work just like I'm used to it working? Include headers -> link with libs and go?

At least it works now, thanks a great deal
Because the build for SDL on macosx requires carbon (or cocoa, I can't remember which) -- and that is objective - c, hence the SDLMain.h and SDLMain.m being necessary.
Okay. So when I've finished a test version of the game I don't need those files to run, that's nice. Thanks for the help!

This topic is closed to new replies.

Advertisement