debugging with leJos

This is where you talk about the NXJ software itself, installation issues, and programming talk.

Moderators: roger, 99jonathan, imaqine

debugging with leJos

Postby quilkin » Sun Dec 30, 2012 2:57 pm

Hi
Having just acquired a NXT 2 kit I am trying to decide what programming language to use. I have found some other treads comparing leJos and RobotC for speed, functionality etc but not comparing ease of debugging.
Since I have loads of experience with Csharp I would prefer to use leJos (Java and Csharp are pretty similar) and the integration with Eclipse seems well-engineered. But, with leJos is it really necessary to work with remote control to effectively debug programs running on the NXT, and then to have to add in special debug lines? In RobotC I can see set breakpoints, see variables etc while the code runs on the NXT, without changing any code. But maybe am I missing something with leJos?
Thanks
quilkin
New User
 
Posts: 4
Joined: Sun Dec 30, 2012 2:40 pm

Re: debugging with leJos

Postby skoehler » Sun Dec 30, 2012 3:18 pm

Recently, remote debugging capabilities have been added to leJOS. As far as I'm aware you can step through your program with the Eclipse Java debugger if you install the leJOS Eclipse plugin.
skoehler
leJOS Team Member
 
Posts: 1114
Joined: Thu Oct 30, 2008 4:54 pm

Re: debugging with leJos

Postby quilkin » Sun Dec 30, 2012 7:01 pm

Thanks for the quick reply.
I have the Eclipse plugin and am trying to run the example at http://lejos.sourceforge.net/nxt/nxj/tutorial/ErrorHandlingAndDebugging/ErrorHandling_and_debugging.htm but the debug window does not have any tools available, e.g. the stepping icons are greyed (the window looks nothing like the example in Eclipse help, it just has many lines repeating "HelloWorld [LeJOS NXT Programs]") .
Adding a breakpoint to the code appears to have no effect, the NXT screen shows"Remote Console.." but not what I would expect from the breakpoint. So what am I doing wrong? I have use loads of different IDE's in the past but can't get this to work.
thanks
quilkin
New User
 
Posts: 4
Joined: Sun Dec 30, 2012 2:40 pm

Re: debugging with leJos

Postby skoehler » Sun Dec 30, 2012 7:38 pm

You need to select "Remote Debug Monitor" instead of "Normal Debug Monitor" in the preferences of the plugin or for the specific run configuration in Eclipse.
Also, you have to select "Debug As -> LeJOS NXT Program" instead of "Run As -> LeJOS NXT Program" when launching/uploading the program.
skoehler
leJOS Team Member
 
Posts: 1114
Joined: Thu Oct 30, 2008 4:54 pm

Re: debugging with leJos

Postby gloomyandy » Sun Dec 30, 2012 9:02 pm

I don't think any of the new debug features are available in a released version of leJOS. You need to use the developers snapshot to get them. Not 100% sure which version of the Eclipse plugin is needed, Sven? The tutorial documents the released version which does not have the capability to set breakpoints etc.

Note that this feature is very new. It is basically an implementation of the standard Java debugging interface and is pretty complex, requiring co-ordination between Eclipse, a network jdwp proxy on the PC, special background threads running alongside your Java code and code in the leJOS firmware, to work. It has not been used very much other than by the developers, so you may hit problems. It currently only operates over Bluetooth (due to limitations in the Lego USB drivers).
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3004
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: debugging with leJos

Postby quilkin » Sun Dec 30, 2012 9:37 pm

Two responses in 2 hours on a Sunday evening is impressive!
Skoehler, I did use 'debug as... ' but didn't have 'remote debug monitor' set - although I have now and see no difference in performance.
Gloomyandy, I see that in the 'Configuration' options there is 'Start nxj console after upload (not functional yet)' - so maybe I need to wait until a further release. BTW I am using bluetooth, and my Eclipse is running on a Mac, if that's any help, although I could switch to Windows7 if it may work there.
Thanks for your input
quilkin
New User
 
Posts: 4
Joined: Sun Dec 30, 2012 2:40 pm

Re: debugging with leJos

Postby skoehler » Sun Dec 30, 2012 9:51 pm

quilkin wrote:Two responses in 2 hours on a Sunday evening is impressive!
Skoehler, I did use 'debug as... ' but didn't have 'remote debug monitor' set - although I have now and see no difference in performance.
Gloomyandy, I see that in the 'Configuration' options there is 'Start nxj console after upload (not functional yet)' - so maybe I need to wait until a further release. BTW I am using bluetooth, and my Eclipse is running on a Mac, if that's any help, although I could switch to Windows7 if it may work there.
Thanks for your input


Remote debugging is USB only as far as I am aware.

I'm not sure what you expect from nxj console. The only service is, that you can view the text that is printed to System.out and the LCD on your Mac. It has nothing to do with remote debuging (i.e. stepping though a program).
skoehler
leJOS Team Member
 
Posts: 1114
Joined: Thu Oct 30, 2008 4:54 pm

Re: debugging with leJos

Postby gloomyandy » Mon Dec 31, 2012 9:51 am

The new debug feature only runs over Bluetooth at the moment due to issues with having both read and write threads active at the same time on the PC side. It may work over USB on Linux, but I think you will have to make code changes to enable it. The code to listen for the JDWP connection is here:
http://sourceforge.net/p/lejos/code/693 ... erver.java
Line 189 onwards.

Andy
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3004
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: debugging with leJos

Postby skoehler » Mon Dec 31, 2012 3:55 pm

Oh, didn't know it was bluetooth only. Also, the debug feature is not part of leJOS 0.9.1-x. You will have to use a snapshot of leJOS, which your can download from SVN trunk/snapshot.
Furthermore, you have to use a special plug-in that supports remote debugging. For now, it is available at
http://lejos.sourceforge.net/tools/ecli ... -snapshot/
Also, I was wrong and remote debugging only works via bluetooth.

Sorry for not mentioning that earlier. It was an honest mistake. I thought, remote debugging was released as part of the 0.9.1-x series.
skoehler
leJOS Team Member
 
Posts: 1114
Joined: Thu Oct 30, 2008 4:54 pm

Re: debugging with leJos

Postby quilkin » Wed Jan 02, 2013 5:08 pm

Hi guys
Thanks for the suggestions, but I got hopelessly lost trying to patch in these new files. I think I'll wait until there's a new complete release.
quilkin
New User
 
Posts: 4
Joined: Sun Dec 30, 2012 2:40 pm

Re: debugging with leJos

Postby kirkpthompson » Mon Jan 07, 2013 1:59 am

quilkin, using the snapshot isn't too terrible. This post should help:
http://lejos.sourceforge.net/forum/viewtopic.php?t=1828&highlight=snapshot

Best,
-K
Leg Godt!
User avatar
kirkpthompson
leJOS Team Member
 
Posts: 282
Joined: Wed Dec 05, 2007 1:27 am
Location: New Mexico, USA


Return to NXJ Software

Who is online

Users browsing this forum: No registered users and 1 guest

cron
more stuff