This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Exception handling problem on mips-wrs-vxworks


I am having problems getting exception handling to work on the
mips-wrs-vxworks platform.  I can trace through the unwinding code and
everything seems fine untill the macro: 

#define uw_install_context(CURRENT, TARGET)				\
do {									\
  long offset = uw_install_context_1 ((CURRENT), (TARGET));		\
  void *handler = __builtin_frob_return_addr ((TARGET)->ra);		\
  __builtin_eh_return (offset, handler);				\
} while (0)

in unwind-dw2.c is called.  In the following assembly dump:

                        _Z7testFn2v:
0x8000fa5c  27bdffc8    addiu           sp,sp,-56
0x8000fa60  ffbf0030    sd              ra,48(sp)
0x8000fa64  ffbe0028    sd              s8,40(sp)
0x8000fa68  03a0f02d    dmove           s8,sp
0x8000fa6c  0c003e8c    jal             _Z7testFn3v
0x8000fa70  00000000    nop
0x8000fa74  08003ea6    j               0x8000fa98
0x8000fa78  00000000    nop
0x8000fa7c  0c01a8f8    jal             __cxa_begin_catch
0x8000fa80  0080102d    dmove           v0,a0
0x8000fa84  3c048014    lui             a0,0x8014
0x8000fa88  0c021ee0    jal             printf
0x8000fa8c  64845530    daddiu          a0,a0,21808
0x8000fa90  0c01a912    jal             __cxa_end_catch
0x8000fa94  00000000    nop
0x8000fa98  03c0e82d    dmove           sp,s8
0x8000fa9c  dfbf0030    ld              ra,48(sp)
0x8000faa0  dfbe0028    ld              s8,40(sp)
0x8000faa4  03e00008    jr              ra
0x8000faa8  27bd0038    addiu           sp,sp,56
0x8000faac  00000000    nop

The handler in this macro points to 0x8000fa7c.  But instead of this
address, it jumps to 0x8000fa74 and then jumps right past the catch block.
This is the test code I am working with:

void testFn1(void)
{
    throw exception();
}

void testFn3(void)
{
    testFn1();
}

void testFn2(void)
{
    try
    {
        testFn3();
    }
    catch(...)
    {
        printf("Caught gen exception for fn 1 \n");
    }
}

Does anybody have any ideas about what could be going wrong here?

Thanks,

Gerrit Nagelhout
Sandvine Inc.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]