← Back to team overview

yade-users team mailing list archive

Re: yade-flat

 

Ye Yonggeng said:     (by the date of Wed, 05 Jul 2006 11:53:28 +0200)

> On Wed, 2006-07-05 at 00:07 +0200, Janek Kozicki wrote:
> > I have sucessully debugged yade inside kdevelop using yade-flat.
> > Tommorow I'll post step by step instructions.
> > 
> 
> Great, I am waiting for your instructions.

First make sure that you have latest SVN, I have commited some changes to
yade-flat so that it will work.

Pictures are in attachamnets.

Please tell us if the instructions are good. I want to put it on the
webpage, so if anything is unclear, please say about this - so I will
improve this instructions.

------------------------
Debugging inside kdevelop


Debugging yade inside kdevelop is only possible when using yade-flat
because kdevelop is unable do debug across separate plugin files. Also
before kdevelop is started, the LD_LIBRARY_PATH must be set correctly,
the best way to do that is to launch yade from terminal, after setting
LD_LIBRARY_PATH. So to start kdevelop for debugging do this:

   cd trunk
   ./yade-scripts/makeFlat
   cd yade-flat
   export LD_LIBRARY_PATH=/home/joeuser/YADE/lib/yade/yade-libs
   kdevelop3 ./flat.kdevelop

Remember to substitute joeuser with your user name.

When kdevelop starts, the first thing is to check "Subproject Settings"
(Fig. 1). In "Build Options" (Fig. 2) you can set any additional
compilation flags, like -fPIC. Make sure that in "Includes" (Fig. 3) a
correct include path is given, otherwise you will get errors marked with
red arrow on Fig. 3 (error: yade/yade-core/BoundingVolume.hpp: No such
file or directory).

NOTE: It is important that normal yade version is *already* installed
somewhere on your system (for example in your home directory ~/YADE),
and that it is recompiled succesively when you make changes using
yade-flat. If those two versions get out of sync, you may experience
weird problems. Luckily all your modifications done inside yade-flat are
also done in normal yade version, because all the files in yade-flat are
symlinks to real files


Fig. 1 Qmake Manager's Subproject Settings 

Fig. 2 Build Options, adding -fPIC flag
  	
Fig. 3 Adding include path 

Fig. 4 Executing yade 	

Fig. 5 Debugging inside kdevelop 	


Also make sure that in "Subproject Settings" a checkbox "debug" is
marked, so that yade will be compiled in debug mode (it should be
already checked correctly). Now you can compile yade, clicking icon
"rebuild project". When compilation is finished, click "execute main
program" to check that yade runs correctly. Upon execution plugin loader
will get confused and will print errors that plugins failed to load
(Fig. 4). Those plugins cannot be loaded because they already exist
inside yade (huge, 100MB) binary. So they will work, even though their
load failed.

Probably in filegenerator you will have to specify a different path to
generate scene.xml, because directory ../data will not exist.

Ignore error on exit 'double free or corruption', I'm working now to fix this.

Now, open your class where you want to debug, SomeClass.cpp, right click
on suspicious line and pick from menu "toggle breakpoint". Then in the
upper menu pick "Debug->start" (make sure that you have gdb installed).
Program execution will be a bit slower, so be prepared to wait.

Finally when program execution reaches suspicious line, yade will be
suspended (so it will not redraw itself) and you will have control over
yade's behaviour from inside kdevelop. On figure 5 you can see that I'm
watching 'f' variable. Force values for x,y and z are inside red circle.

Finally, if you ever need to change execution flags for yade (for
example because you want to debug from kdevelop using NullGUI), then you
can do that in "Project->Project Options->Debugger" and
"Project->Project Options->Run Options"



Updating yade-flat


If you want to create new class when working with yade-flat, you
shouldn't add it into trunk/yade-flat directory, but instead you should
add it into proper place in the package that you are working on. When
this file is added, you should execute ./yade-scripts/makeFlat and
symlinks to newly added files will appear inside yade-flat. Then using
"Qmake Manager" you can add those files to the project. Right click on
"HEADERS" then add .hpp file, similarly add .cpp file.

You should pay attention that only symlinks to .cpp, .hpp, .h, .c, .tpp,
.ipp files are inside trunk/yade-flat directory. If a real file gets
there by accident, then there is a risk that it will be accidentally
deleted.

Use ./yade-scripts/rmFlat to remove all those symlinks. It is useful
when examing what changes were done to the project, and when
cleaning.

  

-- 
Janek Kozicki                                                         |

Attachment: kdev1.png
Description: PNG image

Attachment: kdev2.png
Description: PNG image

Attachment: kdev3.png
Description: PNG image

Attachment: kdev4.png
Description: PNG image

Attachment: kdev5.png
Description: PNG image


Follow ups

References