Using a real debugger with your agent

AI discussion, ideas, and SDK help.
Post Reply
User avatar
dustin
Lux Creator
Lux Creator
Posts: 10433
Joined: Thu May 15, 2003 2:01 am
Location: Cascadia
Contact:

Using a real debugger with your agent

Post by dustin » Fri Mar 20, 2015 5:17 pm

While building an agent, it can be very useful to get your agent loaded using an actual debugger. Here are some links and instructions for making that happen in a few different IDEs. I've copied this information over from an old wiki page, so that it could be kept up-to-date easier.


XCode: see this forum thread

Eclipse: see this forum thread

NetBeans:
Create a new project
In the project properties, Sources, add the LuxSDK/src folder to the Source Package Folders
In the project properties, Libraries, compile tab, add LuxCore.jar if you are on Windows. In OSX, create an alias to /Applications/Lux.app/Contents/Resources/java/ and use it to add MRJAdapter.jar and LuxCore.jar
In the project properties, Run, set main class as com.sillysoft.lux.Lux, and set the Working Directory as the Lux folder (where you found LuxCore.jar)
From the main interface, project (or files) tab, select the src directory, drill down to com/sillysoft/lux/agent, create a new empty java file and copy another bot (like Angry.java) into it
From the build menu, Build the main project (F11)
If you want, set breakPoints in your source (click to the left of any line), and from the Run menu, Debug Main Project (F5).


IntelliJ IDEA using remote debugging (JPDA):
Add these line to the Info.plist file within Lux.app/Contents:

VMOptions
-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005

Then create a run configuration that uses the default remote settings and make sure your agent class compiles to the Library dir where it should go normally. Then run Lux normally (separately), and debug in IDEA. You can set breakpoints that intercept normal Lux action.

Post Reply