- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
I am trying to debug a C++ application with gdb-ia, but some functions are missing debug information (while other functions are ok).
All files are compiled with the same compiler options. This is an extract from the Makefile:
CC=icc CFLAGS=-I../cpp_src -O0 -debug all -g -W -Wall -fPIC -march=native -fast -ansi-alias \ -fopenmp -finline -funroll-loops -no-prec-div -qopt-prefetch -unroll-aggressive \ -m64 -auto-ilp32 -I../src -xCORE-AVX2 -mkl -fma -I/opt/local/include/ LDFLAGS=-L/opt/local/lib -O0 -debug all -g -fopenmp -lboost_system-mt -lboost_timer-mt -lstdc++
When starting the executable in gdb-ia, there is no debug information at the first line of "main", (i.e. "step" results in a warning about no line number information, and the function runs to completion), but breakpoints in other places do stop on a line with valid source.
If I strip all source from the Makefile, and reduce main.cpp it to a simple one-liner, it eventually does debug properly.
Is there something obvious I've missed (I have not used icc before)? If it is important, this example makes use of AVX2 instructions, #pragma unroll's, and #pragma omp directives.
Many thanks,
Kevin
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The #pragma omp directives are the culprits. Now to figure out how to debug multithreaded apps in GDB...!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Kevin,
when you set a breakpoint near an OpenMP directive/pragma you might step into the OpenMP runtime (look out for calls into __kmpc*). The warnings then are because the sources are not found for the OpenMP runtime, which is OK. I guess you used "step" instead of "next" - the latter jumps over any call/jump and hence would not follow execution into the OpenMP runtime.
You should be always able to set breakpoints at code that you've compiled with the above compiler/linker options. However, calls into external libraries might not always have debug information (i.e. OpenMP runtime) .
I'm not sure why the function runs to completion when stepping... for understanding that I'd need some more information, like an example, disassembly, etc.
Best regards,
Georg Zitzlsberger
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Georg
Thanks very much for your reply. I actually found, by elimination, that the "-fast" compiler option caused the issues with missing symbols, not the #pragma omp directives.
For now I am able to debug OK.
Many thanks, Kevin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Kevin,
-fast is (currently) an alias for a set of options:
-ipo, -O3, -no-prec-div, -static, -fp-model fast=2, and -xHost
See also: https://software.intel.com/en-us/node/581705
If you first specify -O0 and then later in the option set -fast, it sets -O3 (because of -fast contains -O3). This enables high performance optimizations and as such stepping in general appears to be random due to various optimizations.
I somehow overlooked that in your original post.
Best regards,
Georg Zitzlsberger
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
I got some errors after trying to make a c++ project using icc compiler
as part of Makefile
CC=icc
CFLAGS=-I../cpp_src -W -Wall -O3 -march=native -fast -ansi-alias \
-fopenmp -finline -funroll-loops -no-prec-div -qopt-prefetch -unroll-aggressive \
-m64 -auto-ilp32 -I../src -xCORE-AVX2 -fma -mkl -I/opt/local/include/
LDFLAGS=-L/opt/local/lib -fopenmp -lboost_system-mt -lboost_timer-mt -mkl -lPcmMsr
#
EXEC=main.icc
#CFLAGS=-Wa,-q -I../cpp_src -W -Wall -ansi -pedantic -O3 -Wall -funroll-loops -ftree-vectorize \
# -msse4a -march=native -mtune=native -ffast-math -fopenmp \
# -fstrict-aliasing -fprefetch-loop-arrays -I../src
after running 'make' command I got the following messages in the terminal:
[LINKING] main.icc
ipo: warning #11012: unable to find -lboost_timer-mt
ipo: warning #11012: unable to find -lPcmMsr
ipo: warning #11021: unresolved _ZTVN10__cxxabiv117__class_type_infoE
Referenced in /tmp/ipo_icchW4mOn.o
ipo: warning #11021: unresolved __cxa_pure_virtual
Referenced in /tmp/ipo_icchW4mOn.o
ipo: warning #11021: unresolved _ZdlPv
Referenced in /tmp/ipo_icchW4mOn.o
ipo: warning #11021: unresolved _ZTVN10__cxxabiv120__si_class_type_infoE
Referenced in /tmp/ipo_icchW4mOn.o
I knew that there is something wrong in referring to -lboost_system-mt -lboost_timer-mt but I am not sure how to resolve the problem
could you please help me out with this issue.
Best regards
Madjid
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page