IBAMR / autoibamr

GNU Lesser General Public License v3.0
10 stars 3 forks source link

Cannot debug by GDB when customising examples #116

Closed Zhonglu closed 1 year ago

Zhonglu commented 1 year ago

Hi,

When I try to debug examples by GDB, I found that I cannot trace back to many source codes.

Is there any fix for this or should I just install the traditional way by using the autoibamr-downloaded packages?

Autoibamr is very useful and I hope we can also debug by its build.

Appreciate any comment,

Mike

drwells commented 1 year ago

This should work. Did you run autoibamr with --enable-debugging?

Zhonglu commented 1 year ago

Thanks for the prompt reply!

Yes, I believe this installation is the debug version with --enable-debugging. When I use gdb in the VS code, I can trace back to source code at tmp/build/petsc-lite-3.17.2/src, and tmp/unpack/SAMRAI-2.4.4, but I can not trace back to the IBAMR relevant source code like example.cpp.

Perhaps I should reinstall a newer version of IBAMR? Or is that due to some mechanisms with CMake? I used to install manually by the “configure” method, which allows me to trace back to every piece source code. Or is that because I should use flag of "-o0" everywhere?

I just start to wonder, as a non-CS background person, should I learn more about the relevant CS-knowledge to better use this library?

Appreciate any comment.

Zhonglu commented 1 year ago

Hi,

Sorry for the question. I just reinstall by autoibamr and the debugging goes well. Probabaly accidentally changed something previously.

Many thanks for having a look.

Mike

drwells commented 1 year ago

I'm not sure exactly what caused the problem but it sounds like you fixed it. One possibility for trying to debug a similar issue in the future, when using CMake, is to build your project with

make VERBOSE=1

to have the generated Makefile print out the commands it runs. You should see -g or -ggdb (and not O2 or O3) in the call to the C++ compiler.