I'm running in to some strange problems when coding with libnds and I'm wondering if it's caused by overrunning the bounds of the stack. Is there any way to check how much of the stack space is being used?
To elaborate, I have a Sprite class (in C++) which can allocate its own area in VRAM as part of the constructor (using oamAllocateGfx). When I create new instances of Sprite and then later try to use libfat, fatInitDefault() will cause the program to lock up.
When I attached GDB to the program in that state (in Desmume) I got this backtrace:
(gdb) bt
#0 0x0201d660 in _malloc_r ()
#1 0x0207863c in _FAT_disc_interfaces ()
Backtrace stopped: frame did not save the PC
Now if I remove the call to oamAllocateGfx in the constructor, the freezing up doesn't happen. Also if I call oamAllocateGfx from e.g. main() it doesn't trigger it either. I can't figure out any regular cause of it, apart from possibly stack overflow.
Check for stack overflow
Who is online
Users browsing this forum: Google [Bot] and 9 guests