how to recompile with "-g" option to use debug tool, gdb

Asked by Masayuki

Hello,

I want to read the source code of YADE by using debug tool, gdb
which allows me to trace the source code step by step.
To use it, I need to add "-g" option when compiling.
However I cannot find compile command such as "gcc" in Makefile
Please tell me where the compile option can be set.

Also, I need to add "gdb" to execution command for reading the code step by step.
Please tell me where is the executable file made by c++.

Thanks,

Masayuki

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Bruno Chareyre
Solved:
Last query:
Last reply:
Revision history for this message
Anton Gladky (gladky-anton) said :
#1

Hi,

"-g" flag will be added automatically, if you compile Yade
in debug-mode [1]. Our Makefile is generating dynamically
by cmake and is dependent on parameters, which you input
during configuration step.

[1] https://github.com/yade/trunk/blob/master/CMakeLists.txt#L79

Best regards

Anton

2015-12-03 5:02 GMT+01:00 Masayuki <email address hidden>:

> New question #276590 on Yade:
> https://answers.launchpad.net/yade/+question/276590
>
> Hello,
>
> I want to read the source code of YADE by using debug tool, gdb
> which allows me to trace the source code step by step.
> To use it, I need to add "-g" option when compiling.
> However I cannot find compile command such as "gcc" in Makefile
> Please tell me where the compile option can be set.
>
> Also, I need to add "gdb" to execution command for reading the code step
> by step.
> Please tell me where is the executable file made by c++.
>
> --
> You received this question notification because your team yade-users is
> an answer contact for Yade.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>

Revision history for this message
Masayuki (inba-masayuki) said :
#2

Thank you for quick replying.

I could compile with "-g" flag.

Then, I want to execute YADE by debug mode.
Can I execute YADE in debug mode for step-wise execution and break points?
I expected I could use gdb for C++ debug or pdb for python debug.

Thanks,

Masayuki

Revision history for this message
Anton Gladky (gladky-anton) said :
#3

Never did it, sorry. I use such a mode if I want to get
some more backtrace information. If you find such a
way, please let us know.

Regards

Anton

2015-12-03 13:22 GMT+01:00 Masayuki <email address hidden>:

> Can I execute YADE in debug mode for step-wise execution and break points?
> I expected I could use gdb for C++ debug or pdb for python debug.
>

Revision history for this message
Best Bruno Chareyre (bruno-chareyre) said :
#4

I never did the step/breakpoint thing directly with gdb, since kdevelop is a very efficient frontend for that.
You just start yade as usual, then you attach the process.
Check this: https://yade-dem.org/wiki/Debugging_using_Kdevelop
Bruno

Revision history for this message
Masayuki (inba-masayuki) said :
#5

As you said I'm beginner of Yade.
kdevelop is nice though I am struggling to use it.
I'll try to read the code with it.

Thank you so much for answering about very basic question.

Masayuki

Revision history for this message
Masayuki (inba-masayuki) said :
#6

Thanks Bruno Chareyre, that solved my question.