2

I have a class:

class A {
public:
    static A& instance();

    ...
    void setValue(int val){ _value = val; }
private:
    int _value;
}
A& A::instance(){
  static A _Instance;
  return _Instance;
}

I am running this on an ARM processor. The issue I am encountering is that the application is triggering an alignment trap in the kernel when I call the instance() method from a particular class (say class B). If I call instance() from anywhere else, I do not encounter the alignment trap.

Alignment trap: not handling instruction e28fc609 at [<0001b588>]

I can see how this would happen if I were casting pointers to mis-aligned values, but I am simply referencing a static object. One would assume that the access would be correctly aligned.

Note the class is grossly simplified. It contains a lot of member variables and methods (not my design!).

Does anyone have any suggestions on where I may be going wrong, or where to look?

4

1 に答える 1

0

Thanks for the input guys. It turns out the root cause of this problem was a segmentation fault. The disassembly showed that the alignment trap pointed to the fault signal handler subroutine. I'm looking into why this happened now, but the question I originally asked is no longer relevant.

于 2011-03-24T11:18:01.047 に答える