Menu

Can't get debugging to work with Eclipse

Help
jelamb
2014-03-23
2014-03-24
  • jelamb

    jelamb - 2014-03-23

    I've followed the tutorial for running your robot in Eclipse, followed by the one for debugging from Eclipse here: http://robowiki.net/wiki/Robocode/Eclipse/Debugging_Robot I can successfully run Robocode from within Eclipse, and my robot appears in the robot list in Robocode. However, when I launch a battle with my robot, he sits there and executes no commands. Trying to debug (following the previously mentioned instructions) Eclipse never hits any breakpoints I set. It does not enter debug mode, but when I change manually it does have the pause/stop commands enabled, and the Resume command disabled. All the various step commands are disabled. Very curious - any ideas? I've been trying to get my robot to do anything for hours now :(

     

    Last edit: jelamb 2014-03-23
  • Flemming N. Larsen

    First of all, make sure you followed these two guides prior to the Debugging Robot in Eclipse article:
    http://robowiki.net/wiki/Robocode/Eclipse/Create_a_Project
    http://robowiki.net/wiki/Robocode/Add_a_Robot_Project

    Your robot must be added in the Development Options in Robocode.

    Also make sure that the -Ddebug=true VM argument is set properly in the Eclipse launch configuration.

    Also make sure that you choose the Debug button (green bug icon) in order to enter the debugging mode. Otherwise Robocode will run, but not in debugging mode, and hence never enter any breakpoints.

    Try to put breakpoints in several places, e.g. in onScannedRobot(), on the first line of your run() method etc.

    Last thing is to try to enable or disable the "Pause/Debug" button on the Robocode window in order to allow Robocode to run the robot code etc.

    I have just created my own robot from scratch with Robocode 1.9.1.0 running in Eclipse 4.3 SR 2 with no problem. I am able to single-step debug etc.

    I hope it helps. :-)

     
  • jelamb

    jelamb - 2014-03-24

    Unfortunately, I did follow those guides, and did everything you listed :(. I actually made a pretty complex robot in C# (which ran great) and a week ago it started crashing Robocode anytime I tried to run it. After a lot of fiddling I found that any time I use any setX commands it would crash. If I ONLY had Robot commands such as TurnRadarRight(360) then it will run, but as soon as I add a set/execute, Robocode crashes to desktop. So that's the backstory.

    After that frustration, I wondered if Robocode being a native Java program was why it CTD'd instead of disabling my bot or something, so I followed all the guides for Eclipse setup and hand-ported my bot into Java. Now I'm at the current state of not crashing Robocode, but it looks like my robots code is never actually used unless, again, I don't use any set/execute commands. Are there any known code constructs that Robocode is incompatible with? The last thing I did before my robot broke was to do an architecture change to using some interfaces and abstract classes so I could use the strategy pattern.

    Oh, another note: there's no errors listed in the Robocode console, or my own robot's console.

     
  • Flemming N. Larsen

    Okay, this is strange.
    Hmm... several causes pops into my mind...

    1) Could be the robot database (cache). Try Options->Clean robot cache

    2) It could be a faulty JDK (Java Developer Kit) installation that has issues for some reason so that 'javac' produces .class files without debug information. You could try resetting the compiler (temporarily) in Robocode (Robot->Editor, Compiler->Options->Reset Compiler) and choose "No" in order to use ECJ (Eclipse Compiler for Java). Then (re)compile your robot and see if this helps?

    3) You could try to rename your 'robocode' folder, e.g. from 'C:\robocode' to 'C:\robocode_old', and then install Robocode again from the robocode-1.9.1.0-setup.jar file into C:\robocode. Then add up your development path for your robot (Eclipse project) again from Options->Preferences->Development Options, and see if the robot will run this time.

    4) If all the above stuff fails, then please send the source file for your robot in an email for me: fnl (at) users.sourceforge.net
    Then I will check if your robot does some nasty stuff that Robocode is not able to cope with. :-)

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.