Trying to understand the exception

Post Reply
lupidan
Posts: 7
Joined: Wed Jun 24, 2009 10:44 am

Trying to understand the exception

Post by lupidan » Fri Jul 17, 2009 9:45 am

Well, sometimes in my program when I hit Home to return to the Homewbrew Channel, a exception take place.
My knowledge in Wii Programming is not very extensive, all I can read from there is that a DSI exception ocurred, and i have the stack copy, wich I think it could help me debbugging.

¿What's a DSI exception?¿How could I translate de Stack Dump into lines of my code?

Thanks in advance :)

Samson
Posts: 35
Joined: Mon May 19, 2008 8:05 am

Re: Trying to understand the exception

Post by Samson » Fri Jul 17, 2009 8:23 pm

lupidan wrote:¿What's a DSI exception?
An illegal memory access, most likely an invalid or NULL pointer.
¿How could I translate de Stack Dump into lines of my code?

Code: Select all

Usage: ./powerpc-gekko-addr2line [option(s)] [addr(s)]
 Convert addresses into line number/file name pairs.
 If no addresses are specified on the command line, they will be read from stdin
 The options are:
  @<file>                Read options from <file>
  -b --target=<bfdname>  Set the binary file format
  -e --exe=<executable>  Set the input file name (default is a.out)
  -i --inlines           Unwind inlined functions
  -j --section=<name>    Read section-relative offsets instead of addresses
  -s --basenames         Strip directory names
  -f --functions         Show function names
  -C --demangle[=style]  Demangle function names
  -h --help              Display this information
  -v --version           Display the program's version

./powerpc-gekko-addr2line: supported targets: elf32-powerpc aixcoff-rs6000 elf32-powerpcle ppcboot elf32-little elf32-big srec symbolsrec tekhex binary ihex
Report bugs to <http://www.sourceware.org/bugzilla/>
Make sure the code is built and linked with debug information, i.e -g .

lupidan
Posts: 7
Joined: Wed Jun 24, 2009 10:44 am

Re: Trying to understand the exception

Post by lupidan » Sat Jul 18, 2009 6:32 pm

Thanks a lot Samson :)

Well, i went to my Makefile to check if the -g option is enabled

Code: Select all

CFLAGS	= -g -O2 -Wall $(MACHDEP) $(INCLUDE)
And wehenever I try to use the debugger...

Code: Select all

powerpc-gekko-addr2line -e Game.elf
0x813a373c
All I get is this:

Code: Select all

??:0
I guess the debugging information is not present. ¿Should I change something in my code?

UPDATE:
I tried removing the -O2 flag from de CFLAGS, and now it doesn't seem to crash, when It was present, the program randomly crashed when I clicked the home button to return to Homebrew Channel. ¿Possible bug?

Samson
Posts: 35
Joined: Mon May 19, 2008 8:05 am

Re: Trying to understand the exception

Post by Samson » Sat Jul 18, 2009 7:30 pm

Do you have -g in the linker flags, when you create the elf, as well?
BTW: For a test find the address of main(), and see if you can resolve it from the address. And there is a chance that the crash is outside your program.
Have a look at the map file, or the section information printed by readelf, which memory addresses your program actually covers.

lupidan
Posts: 7
Joined: Wed Jun 24, 2009 10:44 am

Re: Trying to understand the exception

Post by lupidan » Sun Jul 19, 2009 12:05 pm

Thanks for answering

Well, my load flags also have -g:

Code: Select all

LDFLAGS	=	-g $(MACHDEP) -Wl,-Map,$(notdir [email protected]).map
And, in the end, the program crashed, I tried to locate the code dump:
8133883C:
8133884C:
8133885C:

And in the .elf.map file there isn't a single reference to a line 0x813....

I also tried again powerpc-gekko-addr2line -e Game.elf 0x8133883C but nothing... what am I missing?

Beau
Posts: 6
Joined: Thu Aug 13, 2009 7:13 pm

Re: Trying to understand the exception

Post by Beau » Thu Sep 10, 2009 11:46 pm

You've most likely corrupted/wrote to High MEM1 memory where the loader code is stored.

When your application exits, an attempt is made to re-load the loader (typically HBC) from that memory location.

I'm not sure if LibOGC currently protects against this in sbrk, so that LibOGC itself does not allocate memory out of the loader section when you call malloc.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest