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

Andre Vehreschild vehreschild at sc.rwth-aachen.de
Wed Feb 25 06:39:56 PST 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I've got a problem with an ANTLR generated lexer. The input contains a 
character which is not in the characters to be known by the lexer. Say it's 
';'. When the lexer scans the input it recognizes the character and throws 
the RecognitionException, which I can catch in the lexer and print its 
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?

Greetz,
	Andre
- -- 
Andre Vehreschild -- Institute for Scientific Computing, Aachen University
mailto:vehreschild at sc.rwth-aachen.de , phone: ++49- 241- 80- 24874
GnuPG-key available at http://www.sc.rwth-aachen.de/vehreschild
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQFAPLO8zVF62HujQtARAp6tAJ9jzh5QLckNTDvm3HicRz2IJG7vLgCeI6f0
PS/p15BOmjuNAhsrK0/b1lM=
=04nl
-----END PGP SIGNATURE-----




 
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