[antlr-interest] Antlr 3.2 C-target lexer/parser in exe works, crashes in library

Joost Kraaijeveld jrkraaijeveld at gmail.com
Mon Nov 8 10:47:32 PST 2010


[Note: this is the fourth attempt to post this message so it may appear
multiple times. Sorry about that.]

Hi,

I have a grammar that works OK if the parser and lexer are in the
executable but that crashes if the parser and lexer are in a library.
Parsing small files goes OK, but larger files crash. I don't have a clue
why it does not work. I am hoping that someone is kind enough to help
with this. Any suggestions are *very* welcome.

Running the program in GDB crashes (but I cannot find the problem using
GDB, and believe I have tried).  Running the program with Valgrind does
NOT crash. Another strange thing is that another grammar/parser/lexer
using the same kind of setup does not give any problem.

I have created the smallest possible examples of both programs where the
only difference is where parser and lexer are. Both programs are
autotools-project that should work on any platform with autotools
available. Antlr C-target runtime 3.2 should be in the library path.
Eclipse 3.6 project files are included.

A zipped file can be downloaded here:

http://trac.askesis.nl/downloads/AntlrProblem.tar.bz2

I also have available a SVN repository that contains the two projects:

http://trac.askesis.nl/svn/tidbits/AntlrBug/
http://trac.askesis.nl/svn/tidbits/AntlrDllBug/

where the first is the all-in-executable and the second is the
in-library project.

Running of the programs:

1. Unzip the file in directory of choice. It contains the 2 projects.
2. For each project do:
a. cd to the "build" of that project
b. ../configure
c. ./make
d. ./exe/src/yat ../Danu.spec
where
./exe/src/yat is the libtool executable
../Danu.spec is the file that should be parsed

One can comment out parts of the Danu.spec file using C-style "/**/" or
C++-style "//" comments.


TIA
-- 
Met vriendelijke groeten,

Joost Kraaijeveld
Askesis B.V.
Molukkenstraat 14
6524NB Nijmegen
tel: 024-3888063 / 06-51855277
fax: 024-3608416
web: www.askesis.nl


More information about the antlr-interest mailing list