slaanesh
Certified Guru
I'm porting across a C++ application (Stella) to the GP32. All was going well except I'm getting a "translation" exception (according to the BIOS monitor).
It seems to be happening inside the C++ std lib, specifically near libstdc++.a(string-inst.o).
Here's the code, the highlighted code is where it's bombing. It seems innocent to me.
Any suggestions?
Other information.
I'm using DevKitArm r26, SDL++.
The myProperties array is being constructed from a "new" operator. This is the first value n the array.
I've tried using Mr. Mirko's gp_new_old.cxx (see next code snippet), but it makes no difference.
EDIT: I've just run it again and now it's saying "Alignment exception" at the same point.
Which makes more sense to me as I had no idea what a translation exception was or how to fix it.
As for alignment issues, for me this is a bit easier to deal with in "C" as I am unfamiliar with C++.
Are there any recommended compiler options to make sure things are aligned?
I am already using a customized "new" and "new[]" operator which should be returning aligned memory from a pre-malloced heap.
What about statically declared objects and structures? Could these be a problem?
It seems to be happening inside the C++ std lib, specifically near libstdc++.a(string-inst.o).
Here's the code, the highlighted code is where it's bombing. It seems innocent to me.
Any suggestions?
Code:
GpPrintf("Added prop %d", mySize);
// Add new property to the array
myProperties[mySize].key = key; <---- Translation exception here on this line.
GpPrintf("Added prop key");
myProperties[mySize].value = value;
GpPrintf("Added prop value");
Other information.
I'm using DevKitArm r26, SDL++.
The myProperties array is being constructed from a "new" operator. This is the first value n the array.
I've tried using Mr. Mirko's gp_new_old.cxx (see next code snippet), but it makes no difference.
Code:
using namespace std;
//
// The four functions overload glocal
// new & delete operators..
//
void* operator new( size_t size ) throw(std::bad_alloc) {
//GpPrintf("malloc %d", size);
return ::_sbrk(size);
}
void* operator new[]( size_t size ) throw(std::bad_alloc) {
//GpPrintf("malloc %d", size);
return ::_sbrk(size);
}
void operator delete( void* todel ) throw() {
//::gm_free(todel);
}
void operator delete[]( void* todel ) throw() {
//::gm_free(todel);
}
EDIT: I've just run it again and now it's saying "Alignment exception" at the same point.
Which makes more sense to me as I had no idea what a translation exception was or how to fix it.
As for alignment issues, for me this is a bit easier to deal with in "C" as I am unfamiliar with C++.
Are there any recommended compiler options to make sure things are aligned?
I am already using a customized "new" and "new[]" operator which should be returning aligned memory from a pre-malloced heap.
What about statically declared objects and structures? Could these be a problem?