How to debug and step through code

iCouldBeBatman

New Member
I've downloaded the source and opened the project in IntelliJ Community Edition. I can build and run Terasology with no problems. But I can't figure out how to debug so I can step through the code. I'm new to Gradle and IntelliJ so I don't know how to properly set this up. I'm on Windows 7. Help please?
 

Cervator

Org Co-Founder & Project Lead
Contributor
Design
Logistics
SpecOps
Hi there iCouldBeBatman ! :)

As long as you've run "gradlew idea" which you probably have if you can build and run fine you should be able to debug. On some line of code you're interested in click in the left margin and a red bullet breakpoint should be added. If you then use "Debug" (Shift+F9) instead of "Run" (Shift-F10) the code should run and stop when it gets to the breakpoint, allowing you to step into/over/etc code line by line.
 

iCouldBeBatman

New Member
I ran "gradlew idea" from a command prompt window. Opened the generated Terasology.ipr project file from IntelliJ. At this point, there are no configurations so I can't Run or Debug. I open build.gradle, go to where it says "task run", right click and choose "Create build.run". I select Ok on the Create Run/Debug Configuration dialog. I now have the options to Run or Debug 'build.run'. But when I choose to debug, the program does not stop at my breakpoint. My breakpoint is at the beginning of UIWindow::loadWindow().

What am I missing?
 

Immortius

Lead Software Architect
Contributor
Architecture
GUI
Set it up to run/debug org.terasology.game.Terasology . That is the start point for Terasology (standalone, anyhow).

You can put a breakpoint in that class' main function to go straight into debug.
 

iCouldBeBatman

New Member
Ok, I got it working. I went back into the Edit Configurations dialog and created a new Application Configuration. Pasted org.terasology.game.Terasology for the main class. I can now debug. Thanks.
 
Top