[antlr-interest] antlr3c-3.1b2 bug with setDebugListener

Kaleb Pederson kaleb.pederson at gmail.com
Wed May 7 12:03:23 PDT 2008


I'm just starting with the C runtime, so in the process of trying to
debug my grammar, I turned on -debug which resulted in a segfault.  I
traced it down to setDebugListener not being set on the token-stream
pseudo-object.  I grepped through the code, and it looks like there's
a static function that the function pointer should be set to.

My gdb transcript follows:

(gdb) break src/antlr3parser.c:134
No source file named src/antlr3parser.c.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (src/antlr3parser.c:134) pending.
(gdb) run
Starting program: ./main preface.txt

Breakpoint 1, setDebugListener (parser=0x80698a8, dbg=0x8069a60) at
src/antlr3parser.c:134
134                     parser->tstream->setDebugListener(parser->tstream, dbg);
(gdb) step

Program received signal SIGSEGV, Segmentation fault.
0x00000000 in ?? ()

(gdb) up
#1  0xb7f89853 in setDebugListener (parser=0x80698a8, dbg=0x8069a60)
at src/antlr3parser.c:134
134                     parser->tstream->setDebugListener(parser->tstream, dbg);
(gdb) print parser->tstream
$1 = (pANTLR3_TOKEN_STREAM) 0x8069730
(gdb) print parser->tstream->setDebugListener
$2 = (void (*)(struct ANTLR3_TOKEN_STREAM_struct *,
pANTLR3_DEBUG_EVENT_LISTENER)) 0

Any suggestions for a workaround or did I just miss a step somewhere?

Thanks.

--Kaleb


More information about the antlr-interest mailing list