• Advertisement
Sign in to follow this  

SIGBUS at startup

This topic is 4518 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement
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 <+0156> addis r2,r31,0
0x00002624 <+0160> lwz r2,27208(r2)
0x00002628 <+0164> lwz r12,0(r2)
0x0000262c <+0168> cmpwi cr7,r12,0
0x00002630 &lt;+0172> beq- cr7,0x263c <start+184>
0x00002634 &lt;+0176> mtctr r12
0x00002638 &lt;+0180> bctrl
0x0000263c &lt;+0184> bl 0x84e0 <dyld_stub___keymgr_dwarf2_register_sections>
0x00002640 &lt;+0188> addis r2,r31,0
0x00002644 &lt;+0192> lwz r12,27192(r2)
0x00002648 &lt;+0196> lwz r0,0(r12)
0x0000264c &lt;+0200> cmpwi cr7,r0,0
0x00002650 &lt;+0204> beq+ cr7,0x265c <start+216>
0x00002654 &lt;+0208> mtctr r12
0x00002658 &lt;+0212> bctrl
0x0000265c &lt;+0216> bl 0x2840 <start+700>
0x00002660 &lt;+0220> bl 0x294c <start+968>
0x00002664 &lt;+0224> addis r3,r31,0
0x00002668 &lt;+0228> addi r3,r3,25036
0x0000266c &lt;+0232> addi r4,r1,56
0x00002670 &lt;+0236> bl 0x2b60 <start+1500>
0x00002674 &lt;+0240> lwz r3,56(r1)
0x00002678 &lt;+0244> cmpwi cr7,r3,0
0x0000267c &lt;+0248> beq- cr7,0x2684 <start+256>
0x00002680 &lt;+0252> bl 0x8500 <dyld_stub_atexit>
0x00002684 &lt;+0256> li r0,0
0x00002688 &lt;+0260> addis r2,r31,0
0x0000268c &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,0
0x0000269c &lt;+0280> bne+ cr7,0x2724 <start+416>
0x000026a0 &lt;+0284> b 0x26e8 <start+356>
0x000026a4 &lt;+0288> mr r11,r2
0x000026a8 &lt;+0292> mr r2,r9
0x000026ac &lt;+0296> cmpwi cr7,r0,47
0x000026b0 &lt;+0300> bne+ cr7,0x26b8 <start+308>
0x000026b4 &lt;+0304> mr r8,r11
0x000026b8 &lt;+0308> lbz r0,0(r2)
0x000026bc &lt;+0312> addi r9,r2,1
0x000026c0 &lt;+0316> extsb. r0,r0
0x000026c4 &lt;+0320> bne+ 0x26a4 <start+288>
0x000026c8 &lt;+0324> cmpwi cr7,r8,0
0x000026cc &lt;+0328> beq- cr7,0x26e0 <start+348>
0x000026d0 &lt;+0332> addi r0,r8,1
0x000026d4 &lt;+0336> addis r2,r31,0
0x000026d8 &lt;+0340> stw r0,27188(r2)
0x000026dc &lt;+0344> b 0x26e8 <start+356>
0x000026e0 &lt;+0348> addis r2,r31,0
0x000026e4 &lt;+0352> stw r10,27188(r2)
0x000026e8 &lt;+0356> lwz r0,0(r30)
0x000026ec &lt;+0360> cmpwi cr7,r0,0
0x000026f0 &lt;+0364> bne+ cr7,0x26fc <start+376>
0x000026f4 &lt;+0368> mr r6,r30
0x000026f8 &lt;+0372> b 0x270c <start+392>
0x000026fc &lt;+0376> mr r6,r30
0x00002700 &lt;+0380> lwzu r0,4(r6)
0x00002704 &lt;+0384> cmpwi cr7,r0,0
0x00002708 &lt;+0388> bne+ cr7,0x2700 <start+380>
0x0000270c &lt;+0392> mr r3,r28
0x00002710 &lt;+0396> mr r4,r29
0x00002714 &lt;+0400> mr r5,r30
0x00002718 &lt;+0404> addi r6,r6,4
0x0000271c &lt;+0408> bl 0x2ed4 <__darwin_gcc3_preregister_frame_info+220>
0x00002720 &lt;+0412> bl 0x84c0 <dyld_stub_exit> <== CRASH LINE
0x00002724 &lt;+0416> lbz r0,0(r10)
0x00002728 &lt;+0420> extsb. r0,r0
0x0000272c &lt;+0424> beq- 0x26e0 <start+348>
0x00002730 &lt;+0428> addi r2,r10,1
0x00002734 &lt;+0432> mr r11,r10
0x00002738 &lt;+0436> li r8,0
0x0000273c &lt;+0440> b 0x26ac <start+296>
0x00002740 &lt;+0444> mflr r0
0x00002744 &lt;+0448> bcl- 20,4*cr7+so,0x2748 <start+452>
0x00002748 &lt;+0452> mflr r12
0x0000274c &lt;+0456> addis r12,r12,0
0x00002750 &lt;+0460> mtlr r0
0x00002754 &lt;+0464> addi r12,r12,23928
0x00002758 &lt;+0468> mtctr r12
0x0000275c &lt;+0472> bctr
0x00002760 &lt;+0476> mflr r0
0x00002764 &lt;+0480> bcl- 20,4*cr7+so,0x2768 <start+484>
0x00002768 &lt;+0484> mflr r12
0x0000276c &lt;+0488> addis r12,r12,0
0x00002770 &lt;+0492> mtlr r0
0x00002774 &lt;+0496> addi r12,r12,1900
0x00002778 &lt;+0500> mtctr r12
0x0000277c &lt;+0504> bctr
0x00002780 &lt;+0508> mflr r0
0x00002784 &lt;+0512> bcl- 20,4*cr7+so,0x2788 <start+516>
0x00002788 &lt;+0516> mflr r12
0x0000278c &lt;+0520> addis r12,r12,0
0x00002790 &lt;+0524> mtlr r0
0x00002794 &lt;+0528> addi r12,r12,23928
0x00002798 &lt;+0532> mtctr r12
0x0000279c &lt;+0536> bctr
0x000027a0 &lt;+0540> mflr r0
0x000027a4 &lt;+0544> bcl- 20,4*cr7+so,0x27a8 <start+548>
0x000027a8 &lt;+0548> mflr r12
0x000027ac &lt;+0552> addis r12,r12,0
0x000027b0 &lt;+0556> mtlr r0
0x000027b4 &lt;+0560> addi r12,r12,952
0x000027b8 &lt;+0564> mtctr r12
0x000027bc &lt;+0568> bctr
0x000027c0 &lt;+0572> mflr r0
0x000027c4 &lt;+0576> bcl- 20,4*cr7+so,0x27c8 <start+580>
0x000027c8 &lt;+0580> mflr r12
0x000027cc &lt;+0584> addis r12,r12,0
0x000027d0 &lt;+0588> mtlr r0
0x000027d4 &lt;+0592> addi r12,r12,388
0x000027d8 &lt;+0596> mtctr r12
0x000027dc &lt;+0600> bctr
0x000027e0 &lt;+0604> mflr r0
0x000027e4 &lt;+0608> bcl- 20,4*cr7+so,0x27e8 <start+612>
0x000027e8 &lt;+0612> mflr r12
0x000027ec &lt;+0616> addis r12,r12,0
0x000027f0 &lt;+0620> mtlr r0
0x000027f4 &lt;+0624> addi r12,r12,88
0x000027f8 &lt;+0628> mtctr r12
0x000027fc &lt;+0632> bctr
0x00002800 &lt;+0636> mflr r0
0x00002804 &lt;+0640> bcl- 20,4*cr7+so,0x2808 <start+644>
0x00002808 &lt;+0644> mflr r12
0x0000280c &lt;+0648> addis r12,r12,0
0x00002810 &lt;+0652> mtlr r0
0x00002814 &lt;+0656> addi r12,r12,23768
0x00002818 &lt;+0660> mtctr r12
0x0000281c &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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement