Debugging the Application

From KratosWiki
Revision as of 17:52, 26 March 2009 by Kazem (Talk | contribs)
Jump to: navigation, search

Here we briefly address the debugging procedure. Usually, if you work in Windows, the programming environment such as Visual Studio, provides a built-in debugging tool. However, in Linux it is not the case. We recommend to use a simple debugging program KDbg, which is available for the free download.

FIRST OF ALL!!!! COMPILE KRATOS IN DEBUG!!!!!!! by executing the following: In the Terminal ( Aplications -> Accesories -> Terminal) type:

rm Libs /*

/kratosR1/bjam install -debug

Afterwards, to debug your application you need to add the following line to your application code (we assume, that it is written in Python) somewhere in the beginning (before you start executing any functions):

  x = raw_input("stopped to allow debug: set breakpoints and press enter to continue");

When you execute the application, it will stop at this point, and you will be able to set the breakpoints in the c++ files that you want to debug, and that are being called by your python application.

1) Run KDbg

2) Goto "Executable" and browse python.exe

3) Goto Execution -> Arguements and set the working directory to your application directory and set the command line argument to your application name, e.g.

Working directory


Command line argument

4) Press the run shortcut

Now the following will be executed (once you have done step 3):


5) The line that we have added to in the beginning, which was

  x = raw_input("stopped to allow debug: set breakpoints and press enter to continue")

enables us now to set the break points for the functions we want to debug.

5.1) Go to: File -> Open Source, choose the file you wish to set the breakpoints at. Set the breakpoints at the lines you are planning to debug, e.g. if you want to debug the function CalculateLocalSystem of the UpdatedLagrangianFluid element, set the break point right at the function definition.

  (o)   void UpdatedLagrangianFluid::CalculateLocalSystem(MatrixType& rLeftHandSideMatrix, VectorType& rRightHandSideVector, ...)

To enter inside the internal function call press F10 or F11

6) Enjoy the debugging! (and do not forget that for this Kratos needs to be compiled in the DEBUG, which is done by running):

Look more of core dump

Personal tools