RE: Can't catch any throw on gcc 3.0.4

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Are you using exception-specifications on your methods?

The call to 
> #6  0x400a092a in __cxa_call_unexpected (exc_obj=0x81b9730) at

Suggests that you are throwing an exception that is not listed in a
callers list of valid (expected) exceptions.

eg.

#include <iostream>

struct X
{
   void test() throw (int)   // If anything but an int is thrown it will
not be caught.
   {
        throw char('a');
   }
};

int main(int argc,char *argv[])
{
    try
    {
        X  x;
        x.test();
    }
    catch(char& x)
    {
        std::cout << "Caught Char: (" << x <<")\n";
    }
    catch(int& x)
    {
        std::cout << "Caught Int: (" << x <<"(\n";
    }
    catch(...)
    {
        std::cout << "Something\n";
    }
    return(0);
}



-----Original Message-----
From: gcc-help-owner@xxxxxxxxxxx [mailto:gcc-help-owner@xxxxxxxxxxx] On
Behalf Of Tan-Long Phan
Sent: 01 February 2005 15:30
To: gcc-help@xxxxxxxxxxx
Subject: Can't catch any throw on gcc 3.0.4

Hi 

I'm writing an application on Linux 7.3 using gcc 3.0.4 and having a
little problem with the exception handling. It works fine with MSVC. The
stack was:

Program received signal SIGABRT, Aborted.
0x42029331 in kill () from /lib/i686/libc.so.6
(gdb) where
#0  0x42029331 in kill () from /lib/i686/libc.so.6
#1  0x4202911a in raise () from /lib/i686/libc.so.6
#2  0x4202a8c2 in abort () from /lib/i686/libc.so.6
#3  0x400a0a35 in __cxxabiv1::__terminate(void (*)())
(handler=0x4202a754
<abort>) at ../../../../libstdc++-v3/libsupc++/eh_terminate.cc:47
#4  0x400a0a70 in __cxxabiv1::__unexpected(void (*)())
(handler=0x400a0a70 <__cxxabiv1::__unexpected(void (*)())>) at
../../../../libstdc++-v3/libsupc++/eh_terminate.cc:57
#5  0x400a0a85 in __cxxabiv1::__unexpected(void (*)())
(handler=0x400a0a50
<std::terminate()>) at
../../../../libstdc++-v3/libsupc++/eh_terminate.cc:63
#6  0x400a092a in __cxa_call_unexpected (exc_obj=0x81b9730) at
../../../../libstdc++-v3/libsupc++/eh_personality.cc:417
#7  0x40c28aaa in
com_cae::rti::FM::SlaveFederationManager::throwResponseError()
(this=0x8188548) at
/data/rti/cae/caeRti-1.0.23/mrti/dev/src/FM/CaeRti_SlaveFederationManage
r.cx
x:68


Do you have any idea?

Thanks & Regards

Long



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux