Running Acron under the C++ Debugger

These instructions show how to compile and run acron from inside the Microsoft Visual Studio debugger.

Before you Begin

The first step is to download the Acron source code and compile it. The instructions can be found in the section Building Acron from Source. Be sure to compile with the Optimize setting of 1, otherwise, Visual Studio will not be able to debug properly. Once you have compiled Acron, start up Visual Studio, and ask it to create a new project:

debugacron1.jpg

There are four pieces of information you need to enter into the new project dialog:

  • Tell it to make a “C++ project”

  • Tell it to use a “Makefile”

  • Tell it the name of the project, “debugacron”

  • Tell it where the acron source tree is (ie, “c:acron-b”)

debugacron2.jpg

Click ok, and confirm. You have now created the project, and the project is open for editing. You now need to access the “solution explorer:”

debugacron3.jpg

Normally, you can see the solution explorer in the upper-right corner of Visual Studio. It should show your project name (debugacron). The word “debugacron” needs to be highlighted - if it is not, click on it:

debugacron4.jpg

Now that your project is selected, you can edit its project properties:

debugacron5.jpg

The project property dialog initially looks like this. It contains three subpanels, the “General” panel, the “Debugging” panel, and the “NMake” subpanel. You can see these three subheadings in the left pane:

debugacron6.jpg

There is nothing to fill in on the general panel, so switch to the debugging panel. You need to fill in the command name, the command arguments, and the working directory. For now, we will ask it to debug the Actors/Robots sample program. Since visual studio puts the project file in a subdirectory, the paths need to be preceded by “..” to get to the root of the acron source tree:

debugacron7.jpg

Finally, switch to the “NMake” panel. Here, you can tell it what the command is to recompile acron. I use a bat file “mkp.bat” to compile acron. Since the project file is in a subdirectory, the command needs to be preceded by “cd ..” in order to get back to the root of the acron source tree:

debugacron8.jpg

Visual studio now knows how to run acron, and how to compile it. You can run your program (in this case, the “Actors/Robots” tutorial) by clicking on the Debug menu:

debugacron9.jpg

You can rebuild acron at any time by clicking on the “Build” menu:

debugacron10.jpg

Now that you are running in the debugger, you can open any acron source file and set a breakpoint, or examine data. Of course, it may be advantageous to learn how to use the python debugger as well as the C++ debugger.