problem with stepping into functions

problem with stepping into functions

Hi All,

I am using Intel Application Software Development Tool Suite for Intel Atom Processor. I have built my project with ICC with -debug and -O0 options. And after following the given procedure i am able to get the executable running on the debugger. But the problem is, while debugging I am not able to step into any function or open any file other than the file with main funciton. Only the C file with main() is detected as source file!!

What can be the reason behind this??

Thanks in advance

Regards,
Prashanth

7 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi Prashant,

can you share the exact command line used for both compiler and linker with us (or perhaps the complete makefile)?

It sounds to me as though some symbol info is being stripped out somewhere during the build process.
Assembly files would need to have symbol info generation also explicitely enabled.
If you are debugging shared objects , pleaee have a close look at the shared object debug chapter in the PDF whitepaper attached to following article:
http://software.intel.com/en-us/articles/cross-application-debugging/

Rgds, Rob

Hi Rob,

We use a configure file to generate the Makefiles. I have attached the configer file with this reply.
First i will use "source iccvars.sh" to chose ICC and the configure it with the following command
"./configure --target=x86-linux-icc" instead of just ./configure which will crteat Makefiles for gcc.

The changes i made in the configure file is as follows.
Before the changes :

case ${tgt_cc} in
icc*)
CC=${CC:-icc}
LD=${LD:-icc}
setup_gnu_toolchain
add_cflags -use-msasm -use-asm
add_cflags -debug -O0
add_ldflags -i-static
enabled x86_64 & add_cflags -ipo -no-prec-div -static -xSSE3 -axSSE3
enabled x86_64 && AR=xiar
;;
gcc*)
add_cflags -m${bits}
add_ldflags -m${bits}
link_with_cc=gcc
setup_gnu_toolchain
;;

After Changes:
case ${tgt_cc} in
icc*)
CC=${CC:-icc}
LD=${LD:-icc}
setup_gnu_toolchain
add_cflags -use-msasm -use-asm
add_cflags -debug -O0
add_ldflags -i-static
enabled x86_64 & add_cflags -no-prec-div -static -xSSE3 -axSSE3
enabled x86_64 && AR=xiar
;;
gcc*)
add_cflags -m${bits}
add_ldflags -m${bits}
link_with_cc=gcc
setup_gnu_toolchain
;;

I have bolded the parts i have changed. I have removed "-ipo" since it was giving some build errors. And added -debug and -O0 option. And I have removed the -O3 option as well so that it will not override -O0 option.

And the library we are using is a static library.

Attachments: 

AttachmentSize
Downloadtext/x-sh configure.sh25.68 KB

Hi Prashant,

thanks for the detailed input :-). It looks as though it is not a dynamically loaded memory address resolution issue at al, but simply a question of build flags. That should hopefully make it easy to get you going. The simple answer is that for the CC flags you will need to add -g and not just -debug.

Let me however elaborate on the flags you are using a bit more.

Removing -ipo is not necessary, but because -ipo triggers heavy inlining it may be a good idea to remove it to make debugging easier.
There also is no real need to force -O0 or -Od. Setting -g by defualt will switch the compiler to use -O0 unless -O2 or -O3 are explicitly specified.Having alloptimizations turned off as you do mayhoweverbe beneficial for debugging as well. It may however also potentially impact runtime behavior and thus depending on the bug you would like to find this may not be what you intend.

Let me now talk about the debug flags.

The main compiler flag enabling Dwarf 2/3 symbol info generation in compatibility with GNU is -g. You can specificy "-debug all" in addition to ensure optimal symbol info coverage.

If you had an explixit link step you would also want to add -debug to the LD flags. Since it looks as though you are using ICC as the linker driver this is however not necessary.

Finally I would like to add a few comments on optimization flags.

Using -no-prec-div is indeed a good idea when targeting the Intel Atom processor. an dmay give you a little bit of additional performance. To take advantage of thein-oder instruction scheduler optimiations as well as various heuristics and Intel Atom processor specific instrucisons I would recommend using -xSSE3_ATOM instead of just -xSSE3. I would also recommend using either -x or -ax and not both since these are slightly contradictory flags and the one that will be used would therefore depend on the order in which you hand it over to the compiler.

Thanks, Rob

Hi Rob,

Thanks a lot for the detailed reply. Now i am able to get the source files from the static library. But the probelem is onyl .c and .h files are getting detected by the debugger. What should i do so that even .asm files will get detected? now i am using same flags for compiling asm files as well. Do I have to use different flags??

Thanks and Regards,
Prashanth .

Hi Prashant,

the problem is that in the GNU tools -g is not passed on to the assembler, which means that even for debug builds you do not by default get symbol info for assembly files.

If for your ASFLAGS you explictly specify -gdwarf2 that should take care of it. If you don't run AS directly, but use ICC as your driver to launch the assembler as well you may want to add -Wa,-gdwarf2 or -Xassembler -gdwarf2 to your CCFLAGS.

Rob

Hi Rob,

Thanks a lot for the help :) -gdwarf2 did the trick. Now i am able to get all the files in my project for debugging.

Thanks and Regards,
Prashanth.

Leave a Comment

Please sign in to add a comment. Not a member? Join today