[antlr-interest] C++ Exception-rethrow leads to abort

Ric Klaren klaren at cs.utwente.nl
Wed Feb 25 07:25:43 PST 2004


On Wed, Feb 25, 2004 at 03:39:56PM +0100, Andre Vehreschild wrote:
> contents. But when the following code fragment:
> 
> 		catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& e) {
> 				throw ANTLR_USE_NAMESPACE(antlr)TokenStreamRecognitionException(e);
> 		}
> 
> tries to "re-throw" the exception as a TokenStreamRecognitionException, then 
> the program is aborted. gdb-stackbacktrace:
> 
> (gdb) bt
> #0  0x003a1c32 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
> #1  0x008f9969 in raise () from /lib/tls/libc.so.6
> #2  0x008fb322 in abort () from /lib/tls/libc.so.6
> #3  0x00d6b467 in __cxa_call_unexpected () from /usr/lib/libstdc++.so.5
> #4  0x00d6b4a4 in std::terminate() () from /usr/lib/libstdc++.so.5
> #5  0x00d6b616 in __cxa_throw () from /usr/lib/libstdc++.so.5
> #6  0x0804b5ed in buispecLexer::nextToken() (this=0xbfecfa40)
>     at buispecLexer.cpp:189
> 
> The line 189 of buispecLexer.cpp is exactly the line with the re-throw above.
> 
> Stats: I'm using ANTLR 2.7.2 on a Pentium IV, Fedora Core 1, Kernel  
> 2.4.22-1.2140.nptl, and gcc (GCC) 3.3.2 20031022 (Red Hat Linux 3.3.2-1). 
> 
> Do I miss something? I try to catch all exceptions, i.e. std::exception in the 
> calling main-function, but the program does not care.
> 
> Do you any further information? Is this problem known already?

Do you catch ANTLRExceptions in your main as well ? ANTLR's exceptions are
not derived from std::exception.

Cheers,

Ric
-- 
-----+++++*****************************************************+++++++++-------
    ---- Ric Klaren ----- j.klaren at utwente.nl ----- +31 53 4893722  ----
-----+++++*****************************************************+++++++++-------
  "You know how to use that thing?" [pointing to the sword]
  "Sure.. The pointy end goes into the other guy."
  --- The Mask of Zorro



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
     antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list