CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   SU2 (https://www.cfd-online.com/Forums/su2/)
-   -   gdb can't hit any break point when debug SU2 (https://www.cfd-online.com/Forums/su2/222519-gdb-cant-hit-any-break-point-when-debug-su2.html)

jackLiu November 27, 2019 09:00

gdb can't hit any break point when debug SU2
 
I have a problem when I try to debug SU2.
I run the follow command to compile SU2

./configure CFLAGS=-g --prefix=/home/lau/program/cfd/su2/debug
make install

Then, I run GDB, set point at the main program, then run

[lau@localhost bin]$ gdb SU2_CFD

GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-100.el7
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/lau/program/su2/debug/bin/SU2_CFD...done.

(gdb) b main

Breakpoint 1 at 0x4082d0

(gdb) run inv_NACA0012.cfg

Starting program: /home/lau/program/su2/debug/bin/SU2_CFD inv_NACA0012.cfg
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Breakpoint 1, 0x00000000004082d0 in main ()
Missing separate debuginfos, use: debuginfo-install
glibc-2.17-222.el7.x86_64 libgcc-4.8.5-39.el7.x86_64
libstdc++-4.8.5-39.el7.x86_64

(gdb) step

After I enter the command "step", it will run until the end of program.
I check another shorter cpp program ,it works well.
The OS is Centos 7.0 and gcc is 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC)

TKatt December 2, 2019 08:05

Hey,


CFLAGS are for the C-Compiler and CXXFLAGS are for the C++ compiler. I use CXXFLAGS and have no issues with gdb. So I guess this is where your issue comes from.


https://en.wikipedia.org/wiki/CFLAGS as a reference


I tend to set CXXFLAGS as well as envoronmental variable
Code:

export CXXFLAGS="-g -O0"
I hope this helps, cheers
Tobi

jackLiu December 2, 2019 21:44

Quote:

Originally Posted by TKatt (Post 751243)
Hey,


CFLAGS are for the C-Compiler and CXXFLAGS are for the C++ compiler. I use CXXFLAGS and have no issues with gdb. So I guess this is where your issue comes from.


https://en.wikipedia.org/wiki/CFLAGS as a reference


I tend to set CXXFLAGS as well as envoronmental variable
Code:

export CXXFLAGS="-g -O0"
I hope this helps, cheers
Tobi

Dear Tobi:

It works, think you!
But I think one have to make clean and remake the program after changed the configure arguments. If I just remake, It will not change the exe file.


Jack Liu

TKatt December 8, 2019 17:21

Hey,


I personally have a 'make clean' before every new '(pre)configure' command. Just to make sure nothing funny happens (and I tend to build on a lot of cores so I have no trouble with time :) ).

I am unsure though if a make clean is really necessary ? It might be ok without... but I am by far no expert

What surely is necessary is another '(pre)configure' with the respective CXXFLAGS set: either as environmental variable or in the command directly.


Note that we slowly shift to meson as a build system (away from autotools). I found it pretty easy and straight-forward to use. Check out the docs for building from source on the su2-website https://su2code.github.io/docs_v7/Bu...2-Linux-MacOS/


Cheers, Tobi


All times are GMT -4. The time now is 01:47.