[antlr-interest] Debugging problem

Jean Bovet antlr-list at arizona-software.ch
Sun May 27 16:15:53 PDT 2007


Hi,

Yes, "Debug" will compile and run the parser as long as the grammar  
is targeted to the Java language. The exception you are having is  
probably due to the parser already running or another process using  
the same port. Make sure that no other process is using the debug  
port or that no previous session of the parser is running already in  
the background.

I don't know if C# has the debugging interface yet....

Regards,

Jean

On May 27, 2007, at 8:26 AM, Ruth Karl wrote:

> Gavin Lambert schrieb:
>> At 21:44 27/05/2007, Ruth Karl wrote:
>> >I like ANTLWorks a lot, but I cannot figure out how to tell it how
>> >to debug.
>> >Whenever I try to, it obviously tries to connect (to port 49157
>> >which seems to be the default setting in preferences - but who
>> >... is listening there???) and then (not very surprinsingly)
>> >gets a time-out. I do not see, how I could configure the debugger
>> >or how debugging is supposed to work. My target language is C#...
>> >but I can't get it to work with Java either.
>>
>> There's two separate debugging modes.  The first ("Debug"), only  
>> works with Java AFAIK but automatically compiles and runs the  
>> parser.  The second ("Debug Remote"), I think will work with any  
>> language since it's connecting to an external server.  To use the  
>> second option you have to build a debug parser (extra compiler  
>> option to ANTLR) and start it up, and only *then* start debugging  
>> in ANTLRworks.
>>
>> Also note that ANTLRworks only seems to be able to debug parsers  
>> -- it won't help with debugging the lexer (except indirectly).
>>
> Thanks a lot for your reply: but sorry, what is 'AFAIK'?
>
> For the first ("Debug") option with Java as default target  
> language, the following happens:
>
> error(10):  internal error:  
> org.antlr.runtime.debug.DebugParser.reportError(DebugParser.java: 
> 88): java.net.BindException: Address already in use: JVM_Bind
>
> Exception in thread "main" java.lang.NullPointerException
>    at org.antlr.runtime.debug.DebugEventSocketProxy.transmit 
> (DebugEventSocketProxy.java:108)
>    at org.antlr.runtime.debug.DebugEventSocketProxy.exitRule 
> (DebugEventSocketProxy.java:122)
>    at testParser.document(testParser.java:82)
>    at __Test__.main(__Test__.java:16)
>
> which refers to line 82 in testParser:
>                                    dbg.exitRule("document");
> in the finally-block of its document()-method.
>
> What could be the reason? How can I avoid it and use the debugger?
>
> For the second ("Debug remote") option: As far as I can see, I have  
> to modify the parser then, give it a new constructor, so I can  
> invoke it without a reference to an inputStream. The same for the  
> lexer. And how do I connect it to (which?) DebugEventListener???
>
> Sorry for asking so many probably dumb questions, but I am really  
> confused, especially because the description insinuates that  
> "Debug" 'automatically compiles and runs the parser'...
>
> Ruth



More information about the antlr-interest mailing list