Bus Errors and how to pinpoint them

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
User avatar
Wally
Posts: 663
Joined: Mon Sep 26, 2005 11:25 am

Bus Errors and how to pinpoint them

Post by Wally »

Hi guys,

Im trying to port over Mr.Peanut's Duke 3D to the slim however im having some trouble with some part.

I have got the SDLmain stuff out of the way and added

PSP_MODULE_INFO("Duke3d", 0, 1, 1);
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER|PSP_THREAD_ATTR_VFPU);
PSP_HEAP_SIZE_KB(1024*20);

to the main c file.

After all the playing around I get a bus error as seen below

host0:/> Exception - Bus error (data)
Thread ID - 0x04838B5F
Th Name - user_main
Module ID - 0x04841253
Mod Name - Duke3d
EPC - 0x088E0D20
Cause - 0x1000001C
BadVAddr - 0x00010000
Status - 0x40088613
zr:0x00000000 at:0x08B20000 v0:0x00000000 v1:0x00000000
a0:0x08A0D6C8 a1:0x00000000 a2:0x88240407 a3:0x88013B00
t0:0x00000030 t1:0x00000030 t2:0x00000098 t3:0x88242298
t4:0x09FBFC48 t5:0x40088613 t6:0x089D6B68 t7:0x00088600
s0:0x00000012 s1:0x09FBFE34 s2:0x00000001 s3:0x09FBFEE0
s4:0x00000012 s5:0x00000013 s6:0xDEADBEEF s7:0xDEADBEEF
t8:0x000000A0 t9:0x88300000 k0:0x09FBFF00 k1:0x00000000
gp:0x08A161A0 sp:0x09FBFC80 fp:0x09FBFC80 ra:0x088E0D0C
0x088E0D20: 0xA0400000 '..@.' - sb $zr, 0($v0)

How do i tell where the bug is?

Wally
KickinAezz
Posts: 328
Joined: Sun Jun 03, 2007 10:05 pm

Post by KickinAezz »

I read this somewhere

In psplink shell:
calc $epc-$mod (also try reverse)
Then do:

psp-addr2line -f -e file.elf "the resulting val"
Intrigued by PSP system Since December 2006.
Use it more for Development than for Gaming.
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

Alternatively try running it in GDB and see if it produces something sensible. But the $epc-$mod stuff should work.
User avatar
Wally
Posts: 663
Joined: Mon Sep 26, 2005 11:25 am

Post by Wally »

TyRaNiD wrote:Alternatively try running it in GDB and see if it produces something sensible. But the $epc-$mod stuff should work.
Yeah I tried, thanks to IWN who helped me big time live in chat. Haven't seen you there for a while TyRaNiD :/

The error was some malloc related error to do with save which was buggy as hell anyway.
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

There's always the "tried-and-true" methods of debugging: logging, and waiting. Logging means you print after various points, either to a file or the screen. Waiting is something I like to do - just make a function to waits for you to press a button (which one is passed in to the function) before it returns. Then I just stick different button waits at different points. You can find the area the fault occurs pretty quick that way.
Post Reply