How to debug LIGGHTS

Submitted by jerryfan on Sun, 03/06/2016 - 01:37

Hello everyone,

I am wondering how can I debug LIGGHTS. Does anyone here have the experience of debugging LIGGHTS with gdb or any other debugging tool?

Thanks.

aaigner's picture

aaigner | Sun, 03/06/2016 - 23:03

Hi Jerryfan,

I am using QtCreator. As long as it is a serial run, you just have to set-up the kit with the correct debug-Makefile like ubuntu_15p10_vtk_debug.
Next set-up your simulation (executable and input-script).
Run the Debug-mode.

Bests
Andreas

jerryfan | Fri, 03/11/2016 - 19:57

Thanks for your valuable response. I am out of campus for a few days and I am not able to access my account, sorry for my late feedback. I used to use QtCreator under my Ubuntu environment for c++ programming. It's a great IDE.

I am not an experienced user of LIGGGHTS as I just installed LIGGGHTS a few days ago. I need some details from you.

1. Do you mean that instead of using "make fedora", I should use "make ubuntu_15p10_vtk_debug" to recompile all the source code?
2. The second question is how can I load a case of LIGGGHTS in Qt? (It would be great if you could send me a few screenshots of the qt interface. I knew it's not easy to upload figures if you don't mind. Send it to my email: u0866050@utah.edu)

Thanks in advance.

Daniel Queteschiner | Tue, 03/15/2016 - 16:03

1. yes
2. In Qt Creator you create a new project and choose to import from an existing folder (this will be the src folder of LIGGGHTS). You can setup Qt Creator to compile LIGGGHTS using the make ubuntu_15p10_vtk_debug command in the Projects Build Settings. In the run settings you need to add the additional program parameters to run your case (e.g., -in in.myscript).

jerryfan | Fri, 03/18/2016 - 22:52

Thank you so much for your kind help.

medvedeg | Mon, 03/07/2016 - 11:50

Dear Jerryfan,

You can use Eclipse and QtCreator and do line-by-line debug with breakpoints like in Visual Studio.
As was suggested, use ubuntu_15p10_vtk_debug if you sit in Ubuntu. But from my side I would also suggest to change CCFLAGS and LINKFLAGS from "-g -Og" and "-Og -pg" to "-g3 -O0". This will to the compiler to produce more debug info and switch off optimization. This will help with tracking variables without putting "printf"s and will prevent "optimized out" values.

Alexander Podlozhnyuk

Daniel Queteschiner | Tue, 03/15/2016 - 15:56

As far as Eclipse is concerned, we experienced some erroneous behavior (in backtracing) when using it in some heavy debugging sessions. Qt Creator did not have these problems.

moja | Mon, 04/11/2016 - 18:15

Hi all,
I tried to debug liggghts with the above mentioned, but i failed. can anybody help me.
On my Workstation runs Fedora 23 with qt "Qt Creator 3.6.0 based on Qt 5.5.1" and the newest version of Liggghts.
- I copy "LIGGGHTS-PUBLIC" and "CFDEMcoupling-PUBLIC" in a directory named liggghtsqt
- in qt: (+ new project) -> (Import Project) -> (Import Existing Project) -> (Choose) -> Projectname = (liggghtsqt); Location:([absPfad]/liggghtsqt/LIGGGHTS-PUBLIC/src)
-> (Next) -> (select all files) -> Next -> add to version control = none -> add to_version control (none) -> (finish)
- projects -> (Build & Run) -> Command: "Pathto/liggghtsqt/LIGGGHTS-PUBLIC/src/MAKE/Makefile.fedora"

When i want to build the program with the hammer the Error:
Could not start process "pfad/liggghtsqt/LIGGGHTS-PUBLIC/src/MAKE/Makefile.fedora"
Error while building/deploying project liggghtsqt (kit: Desktop)
When executing step "Custom Process Step"

occured, the same happens when i try the above mentioned ubuntu_15p10_vtk_debug
File.

Can anybody help me please.
greets Momme

Daniel Queteschiner | Wed, 04/13/2016 - 09:26

In Projects -> Build & Run you should have the following settings (note that I'm using Qt creator 3.0.1 so there might be some differences):
Generic Manager -> Build directory should point to the "src" folder of LIGGGHTS
Build Steps -> Make : the Make arguments should be something like fedora (or -j 4 fedora for compilation on 4 processors etc) so that the complete command is make fedora as you would use it in a CLI
Similarily Clean Steps -> Make: should have the Make arguments clean-all sot that the command is make clean-all

Cheers
Daniel

govind | Sun, 08/20/2017 - 15:51

I have compiled the source code with command "make ubuntuVTK_debug" and it generates lmp_ubuntuVTK_debug in src folder. Now I am following your instructions to debug the code with QTCreater.

In the build settings:
For make arguments: make ubuntuVTK_debug
For override /usr/bin/make : I leave it blank

In the run settings:
For Executable I give the path of input scripts as /home/user/folder/in.inputscript
For command line arguments : liggghtsPublic < in.movingMeshGran
For working directory : I leave it blank

Things are not fine with me. What is working directory in run settings ? What is override in build settings?

Govind

govind | Sun, 08/20/2017 - 23:47

Things are fine now. I have resolved the issues and I am able to debug the code.

Thanks
Govind

moja | Wed, 04/13/2016 - 12:44

Hi Daniel,
thanks a lot, now everything works.

govind | Tue, 08/08/2017 - 12:24

I do not find any make file for debug mode like "make auto or make fedora". Exactly I am getting how do I start with debug mode?

Govind

govind | Tue, 08/08/2017 - 12:29

What I did : First I changed the flag from OFF to ON in makefile.user in for debug mode , then I use the command "make auto" to compile but it didn't result anything

govind | Wed, 08/09/2017 - 08:42

When I have installed LIGGGHTS from instructions given in user forum I do not get any "deprecated" folder in MAKE folder of src but while following instructions from official guide of
LIGGGHTS "deprecated" folder appears in MAKE folder. Issue is that I want debug mode so when I hit command "make ubuntuVTK_debug" it throws an error :
Makefile:87: recipe for target 'ubuntuVTK_debug' failed

All make files exist in deprecated folder except few are out of deprecated folder such as makefile.user. So in my case when i try to compile the LIGGGHTS with "make ubuntuVTK_debug"
it doesn't work.

Govind