-
August 31st, 2010, 08:18 AM
#1
SIGBUS error when porting from X86 to ARM
Hello,
I came with a SIGBUS error when importing a C++ code from X86 to ARM. Below is the code snippet where problem occurs, and appreciate your suggestions.
<code>
class clsMatrix {
protected:
double *pM;
int m;
int n;
BOOL m_bAutoDelete;
//m_bAutoDeletenewbAutoDeleteTRUEbAutoDeleteFALSE
public:
clsMatrix();
clsMatrix(int m, int n, double *p = NULL, BOOL bAssign = FALSE);
~clsMatrix();
void Reset();
void Reset(int i, int j, double *p = NULL, BOOL bAssign = FALSE);
// Attributes
int GetM() { return m; }
int GetN() { return n; }
double *GetP() { return pM; }
BOOL EqualSize(clsMatrix &M) { return ((m == M.m) && (n == M.n)); }
public:
// Operators
double * operator [] (int i) { return pM+i*n; }
clsMatrix & operator = (clsMatrix &M);
clsMatrix & operator = (double *p);
clsMatrix & operator = (double x);
clsMatrix & operator += (clsMatrix &M);
clsMatrix & operator += (double *p);
clsMatrix & operator -= (clsMatrix &M);
clsMatrix & operator -= (double *p);
clsMatrix & operator *= (clsMatrix &mtrx); //
clsMatrix & operator *= (double *p);
clsMatrix & operator *= (double a);
clsMatrix & operator /= (double a);
static void X(clsMatrix &mtrx1, clsMatrix &mtrx2, clsMatrix &mtrx); //multiple
static void X(clsMatrix &mtrx1, clsVector &vctr2, clsVector &vctr);
static void X(clsVector &vctr1, clsMatrix &mtrx2, clsVector &vctr);
static void T(clsMatrix &mtrx1, clsMatrix &mtrx); //transpose
static void R(clsMatrix &mtrx1, clsMatrix &mtrx); //inverse
static void S(clsMatrix &mtrx1, int m0, int m1, int n0, int n1, clsMatrix &mtrx, int m = 0, int n = 0);
static void S(clsVector &vctr1, int m0, int m1, clsVector &vctr, int m = 0);
double e();
double e2();
double ei();
public:
BOOL LoadT(char *pszFile);
BOOL SaveT(char *pszFile);
friend class clsVector;
};
clsMatrix::clsMatrix()
{
m = n = 0;
pM = NULL;
m_bAutoDelete = FALSE;
}
</code>
the problem happens in the clsMatrix constructor, whenever a clsMatrix object is declared, the SIGBUS error occurs, unless the contructor is empty with all statements being commented out.
Regards,
Eric
-
August 31st, 2010, 09:59 AM
#2
Re: SIGBUS error when porting from X86 to ARM
Originally Posted by Ericxx
Hello,
I came with a SIGBUS error when importing a C++ code from X86 to ARM.
SIGBUS? That is not a term used by developers using Visual C++ when a crash occurs. Are you using gcc? If so, this forum is specifically for Visual C++ issues. The forum you want is the non-Visual C++ forum.
Below is the code snippet where problem occurs, and appreciate your suggestions.
1) Please use proper code tags when posting code. A code tag on this forum is
[code]
Your code goes here:
[/code]
2) Please post a main() program that demonstrates the error, not just the class.
3) Just on sight, your class is dangerous to use since it has no user-defined copy constructor or assignment operator that takes care of the pointer member variable.
Regards,
Paul McKenzie
-
August 31st, 2010, 03:27 PM
#3
Re: SIGBUS error when porting from X86 to ARM
Without being an ARM expert... I think that a SIGBUS error is caused by a write to an odd address on processors incapable of doing so, check the addresses of the pointers used.
-
August 31st, 2010, 10:43 PM
#4
Re: SIGBUS error when porting from X86 to ARM
Thanks. I have reposted this thread in the non-Visual C++ programming and provided the address of each class member for reference.
To S_M_A, all the member addresses are 4byte apart tho on the target.
here is the reposted thread: http://www.codeguru.com/forum/showthread.php?t=502146
Eric
Last edited by Ericxx; August 31st, 2010 at 10:46 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|