public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Exceptions aborting the program
@ 2002-08-06  6:41 Fernando Jeronymo
  2002-08-06  7:12 ` bjorn rohde jensen
  0 siblings, 1 reply; 4+ messages in thread
From: Fernando Jeronymo @ 2002-08-06  6:41 UTC (permalink / raw)
  To: bjensen; +Cc: bjorn, Fernando Jeronymo, gcc-help, help


but what happens is that in some part of the program I have something like
this:

MyClass::MyMthod()
{
     AnotherClass anotherClass ;
     try
     {
          throw 10;
     }
     catch(int& test)
     {
          std::cerr << test << std::endl ;
     }
     anotherClass.AnotherMethod();
}


AnotherClass::AnotherMethod()
{
     try
     {
          throw 11;
     }
     catch(int& test)
     {
          std::cerr << test << std::endl ;
     }
}



and he is going to throw 10 just fine. But when he tries to throw 11 he
aborts. Plus, any other throw that I have between the main statement and
the MyMethod work just fine. But after AnotherMethod any throw will make
the program to abort.

Any ideas?




stacktrace:
Is there any case where I should use any kind of flags to turn on or
enhance exception handling with gcc?

I have a software that aborts everytime I call an exception. But I can call
exceptions for some part of the code, and then suddenly just after I call a
function (the try-catch statement is the first thing inside my called
function) I try to throw another exception, and then my software abruptely
aborts.

Any help here would be really welcome!

Thanks,
Fernando

P.S> This is the coredump: As oyu can see, from frame 7 to 6 I am just
calling a function. In the part of code relative to frame 7, I throw two
integer exceptions right before calling the "postKeyStroke" function, and
there is nothing between the try-catch statements and the function call.

For frame 6, right in the beginning of my "postKeyStroke" function, I throw
another integer exception, but this time the program just aborts.


#0  0x42029241 in kill () from /lib/i686/libc.so.6
#1  0x4202902a in raise () from /lib/i686/libc.so.6
#2  0x4202a7d2 in abort () from /lib/i686/libc.so.6
#3  0x40178405 in __cxxabiv1::__terminate(void (*)()) (handler=0x4202a664
<abort>)
    at ../../../../libstdc++-v3/libsupc++/eh_terminate.cc:47
#4  0x40178440 in __cxxabiv1::__unexpected(void (*)()) (handler=0x8633500)
    at ../../../../libstdc++-v3/libsupc++/eh_terminate.cc:57
#5  0x401785b0 in __cxa_rethrow () at
../../../../libstdc++-v3/libsupc++/eh_throw.cc:77
#6  0x082c3de7 in STemplateCtl::postKeystroke(DBKEY) (this=0x86825d0,
key=DBKEY_A) at STemplateCtl.C:693
#7  0x081cac68 in StateControllerGlue::processInput(DBKEY) (this=0x86826c8,
key=DBKEY_A)
    at StateControllerGlue.C:78
#8  0x081b5193 in Control::dispatchFromKeyboard(tagMESSAGE*)
(this=0x85ba5f8, msg=0xbfffcdc4)
    at ControlReceive.C:1285
#9  0x081b260e in Control::dispatch(tagMESSAGE*) (this=0x85ba5f8,
msg=0xbfffcdc4) at ControlReceive.C:289
#10 0x081ddd92 in dispatchThruControl(void*, tagMESSAGE*) (msg=0xbfffcdc4)
at SEventLoop.C:453
#11 0x08327845 in SCallback<void (*)(void*, tagMESSAGE*),
tagMESSAGE*>::operator()(tagMESSAGE*) const (
    this=0x8693858, a1=0xbfffcdc4) at
/mnt/pos.dspb/include/Business/SCallback.h:27
#12 0x08327893 in SCallback<void (*)(void*, tagMESSAGE*),
tagMESSAGE*>::execList(tagMESSAGE*) (this=0x0,
    a1=0xbfffcdc4) at /mnt/pos.dspb/include/Business/SCallback.h:34
#13 0x081ddc9d in SEventLoop::dispatch(tagMESSAGE*) (this=0xbfffcda0,
msg=0xbfffcdc4) at SEventLoop.C:398
#14 0x081ddbba in SEventLoop::loop() (this=0xbfffcda0) at SEventLoop.C:363
#15 0x081ddc28 in SEventLoop::loopUntilMsg(tagMESSAGE*, unsigned short,
SProcedure<bool (*)(void*, tagMESSAGE*), bool, tagMESSAGE*>)
(this=0xbfffcda0, msgAddr=0x0, pq=3681, p={_proc = 0x81dd018 <xfer_never>,
_clientData = 0x0})
    at SEventLoop.C:381
#16 0x081dd263 in SEventLoop::untilMsg(tagMESSAGE*, unsigned short,
SProcedure<bool (*)(void*, tagMESSAGE*), bool, tagMESSAGE*>, bool, bool,
SCallback<void (*)(void*, tagMESSAGE*), tagMESSAGE*>*, SCallback<void
(*)(void*, bool), bool>*) (pMsg=0x0, predQ=3681, p={_proc = 0x81dd018
<xfer_never>, _clientData = 0x0}, unlockKeyboard=false,
    inheritDispatch=false, cbs=0x8693858, lprocs=0x86938f8) at
SEventLoop.C:148
#17 0x081ddf0c in SEventLoop::startTopLevel() () at SEventLoop.C:474
#18 0x08068108 in main (nArgc=5, szArgv=0xbffff0e4) at display.C:68
#19 0x42017499 in __libc_start_main () from /lib/i686/libc.so.6



                                                                                                                                              
                    bjorn rohde                                                                                                               
                    jensen               To:     Fernando Jeronymo <FJeronym@siac.com>                                                        
                    <bjensen@fast        cc:     gcc-help@gcc.gnu.org                                                                         
                    mail.fm>             Subject:     Re: Exceptions aborting the program                                                     
                    Sent by:                                                                                                                  
                    bjorn@fastmai                                                                                                             
                    l.fm                                                                                                                      
                                                                                                                                              
                                                                                                                                              
                    08/06/2002                                                                                                                
                    03:18 AM                                                                                                                  
                    Please                                                                                                                    
                    respond to                                                                                                                
                    bjensen                                                                                                                   
                                                                                                                                              
                                                                                                                                              




Hi Fernando,

 This entry in the trace, you provided, makes me think,
that your problem could be due to mismatching exception
specifications, which will lead to std::unexpected being
called. The default handler for unexpected simply terminates
the program.

> #4  0x40178440 in __cxxabiv1::__unexpected(void (*)())
(handler=0x8633500)
>     at ../../../../libstdc++-v3/libsupc++/eh_terminate.cc:57

Yours sincerely,

Bjorn




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Exceptions aborting the program
  2002-08-06  6:41 Exceptions aborting the program Fernando Jeronymo
@ 2002-08-06  7:12 ` bjorn rohde jensen
  0 siblings, 0 replies; 4+ messages in thread
From: bjorn rohde jensen @ 2002-08-06  7:12 UTC (permalink / raw)
  To: Fernando Jeronymo; +Cc: gcc-help

Hi Fernando,

 I am not sure, what is going on there. You might want
to create a small test case, which shows this behaviour,
and try to go through it using a debugger. That is, what
i intend to;)
 gcc/g++ does perform some checking off exception
specifications, but i have only seen warnings about
mismatching specifications on declarations and the
corresponding definitions, and that was using -pedantic -Wall

Yours sincerely,

Bjorn

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Exceptions aborting the program
  2002-08-05 17:51 Fernando Jeronymo
@ 2002-08-06  0:18 ` bjorn rohde jensen
  0 siblings, 0 replies; 4+ messages in thread
From: bjorn rohde jensen @ 2002-08-06  0:18 UTC (permalink / raw)
  To: Fernando Jeronymo; +Cc: gcc-help

Hi Fernando,

 This entry in the trace, you provided, makes me think,
that your problem could be due to mismatching exception
specifications, which will lead to std::unexpected being
called. The default handler for unexpected simply terminates
the program.

> #4  0x40178440 in __cxxabiv1::__unexpected(void (*)()) (handler=0x8633500)
>     at ../../../../libstdc++-v3/libsupc++/eh_terminate.cc:57

Yours sincerely,

Bjorn

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Exceptions aborting the program
@ 2002-08-05 17:51 Fernando Jeronymo
  2002-08-06  0:18 ` bjorn rohde jensen
  0 siblings, 1 reply; 4+ messages in thread
From: Fernando Jeronymo @ 2002-08-05 17:51 UTC (permalink / raw)
  To: gcc-help

Is there any case where I should use any kind of flags to turn on or
enhance exception handling with gcc?

I have a software that aborts everytime I call an exception. But I can call
exceptions for some part of the code, and then suddenly just after I call a
function (the try-catch statement is the first thing inside my called
function) I try to throw another exception, and then my software abruptely
aborts.

Any help here would be really welcome!

Thanks,
Fernando

P.S> This is the coredump: As oyu can see, from frame 7 to 6 I am just
calling a function. In the part of code relative to frame 7, I throw two
integer exceptions right before calling the "postKeyStroke" function, and
there is nothing between the try-catch statements and the function call.

For frame 6, right in the beginning of my "postKeyStroke" function, I throw
another integer exception, but this time the program just aborts.


#0  0x42029241 in kill () from /lib/i686/libc.so.6
#1  0x4202902a in raise () from /lib/i686/libc.so.6
#2  0x4202a7d2 in abort () from /lib/i686/libc.so.6
#3  0x40178405 in __cxxabiv1::__terminate(void (*)()) (handler=0x4202a664
<abort>)
    at ../../../../libstdc++-v3/libsupc++/eh_terminate.cc:47
#4  0x40178440 in __cxxabiv1::__unexpected(void (*)()) (handler=0x8633500)
    at ../../../../libstdc++-v3/libsupc++/eh_terminate.cc:57
#5  0x401785b0 in __cxa_rethrow () at
../../../../libstdc++-v3/libsupc++/eh_throw.cc:77
#6  0x082c3de7 in STemplateCtl::postKeystroke(DBKEY) (this=0x86825d0,
key=DBKEY_A) at STemplateCtl.C:693
#7  0x081cac68 in StateControllerGlue::processInput(DBKEY) (this=0x86826c8,
key=DBKEY_A)
    at StateControllerGlue.C:78
#8  0x081b5193 in Control::dispatchFromKeyboard(tagMESSAGE*)
(this=0x85ba5f8, msg=0xbfffcdc4)
    at ControlReceive.C:1285
#9  0x081b260e in Control::dispatch(tagMESSAGE*) (this=0x85ba5f8,
msg=0xbfffcdc4) at ControlReceive.C:289
#10 0x081ddd92 in dispatchThruControl(void*, tagMESSAGE*) (msg=0xbfffcdc4)
at SEventLoop.C:453
#11 0x08327845 in SCallback<void (*)(void*, tagMESSAGE*),
tagMESSAGE*>::operator()(tagMESSAGE*) const (
    this=0x8693858, a1=0xbfffcdc4) at
/mnt/pos.dspb/include/Business/SCallback.h:27
#12 0x08327893 in SCallback<void (*)(void*, tagMESSAGE*),
tagMESSAGE*>::execList(tagMESSAGE*) (this=0x0,
    a1=0xbfffcdc4) at /mnt/pos.dspb/include/Business/SCallback.h:34
#13 0x081ddc9d in SEventLoop::dispatch(tagMESSAGE*) (this=0xbfffcda0,
msg=0xbfffcdc4) at SEventLoop.C:398
#14 0x081ddbba in SEventLoop::loop() (this=0xbfffcda0) at SEventLoop.C:363
#15 0x081ddc28 in SEventLoop::loopUntilMsg(tagMESSAGE*, unsigned short,
SProcedure<bool (*)(void*, tagMESSAGE*), bool, tagMESSAGE*>)
(this=0xbfffcda0, msgAddr=0x0, pq=3681, p={_proc = 0x81dd018 <xfer_never>,
_clientData = 0x0})
    at SEventLoop.C:381
#16 0x081dd263 in SEventLoop::untilMsg(tagMESSAGE*, unsigned short,
SProcedure<bool (*)(void*, tagMESSAGE*), bool, tagMESSAGE*>, bool, bool,
SCallback<void (*)(void*, tagMESSAGE*), tagMESSAGE*>*, SCallback<void
(*)(void*, bool), bool>*) (pMsg=0x0, predQ=3681, p={_proc = 0x81dd018
<xfer_never>, _clientData = 0x0}, unlockKeyboard=false,
    inheritDispatch=false, cbs=0x8693858, lprocs=0x86938f8) at
SEventLoop.C:148
#17 0x081ddf0c in SEventLoop::startTopLevel() () at SEventLoop.C:474
#18 0x08068108 in main (nArgc=5, szArgv=0xbffff0e4) at display.C:68
#19 0x42017499 in __libc_start_main () from /lib/i686/libc.so.6

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-08-06 14:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-06  6:41 Exceptions aborting the program Fernando Jeronymo
2002-08-06  7:12 ` bjorn rohde jensen
  -- strict thread matches above, loose matches on Subject: below --
2002-08-05 17:51 Fernando Jeronymo
2002-08-06  0:18 ` bjorn rohde jensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).