Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7944 Discussions

Debug symbols always generated when /Qparallel specified (Win and Mac)

petervk
Beginner
383 Views
Compiling any program with /Qparallel enabled causes debug symbols to be emitted and stored in the executable file. Details of many functions appear in the executable file using the standard source file name;function name;line number syntax. Setting the /debug:none option or using the Microsoft /NDEBUG (from within Visual Studio) flag does not alter the inclusion of symbol information in the executable file.

This behavior was noted last year with version 11.0.072 of the Intel C++ Compiler. It persists with version 11.1.065. Compiling a simple "Hello World" application either from the ICL command line or within Visual Studio 2008 when /Qparallel is enabled generates start/end symbol information in the executable file. Compiling:

[bash]#include 


int main(int argc, char** argv[])
{
printf("Hello world\n");
}[/bash]
using compiler options: /c /O2 /Oi /Qipo /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /EHsc /MD /GS /Gy /fp:fast /Fo"Release/" /W3 /nologo /Zi /Qparallel /Qvc9 /Qlocation,link,"c:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\bin" .\\DebugTest.cpp

inserts debug symbols for _main into the executable:
;_main;5;5; Function start
;_main;7;7; Function end

For a non-trivial program, the included debug symbol weight quickly becomes substantial. If /Qparallel is not specified, no debug symbol information is included in the executable. Unfortunately, that does not help much when parallelization is needed.
0 Kudos
5 Replies
Dale_S_Intel
Employee
383 Views
I'm not seeing the problem on Mac:

schouten@schouten-mac02: u74240$ icc -c -parallel hello.cpp
schouten@schouten-mac02: u74240$ dwarfdump hello.o
----------------------------------------------------------------------
File: hello.o (x86_64)
----------------------------------------------------------------------
.debug_info contents:
< EMPTY >

schouten@schouten-mac02: u74240$

On windows, I'm not seeing anything emitted either, neither a .pdb file or anything in the .exe (when I use icc /Qparallel hello.cpp). If I use /Zi, then I see the debug info, which is what I expect.

Can you describe exactly how you detect the presence of debug info in the exe? I see similar results with and without /Zi if I use cl or icl, so I guess I'm a little confused as to exactly what you're seeing.

Thanks!
Dale
0 Kudos
petervk
Beginner
383 Views
I'll need to check on a Mac again later to make sure of the symbols. In a Windows environment the executable file contains symbols. I realized that the command line I posted above had the /Zi switch. I was experimenting with all the Debug Info formats to see if that had any influence on the executable contents (from a debug symbols standpoint). They did not.

Open the generated executable file in a hex viewer. There will be lines for each function using the syntax:

;C:\Dev\Projects\Temp\DebugTest\DebugTest.cpp;_main;5;5;;

Translation: ;;;;;;

In projects that are less trivial, numerous such symbol references appear. These include ones from external libraries including Intel's Performance Primitives. For example, oone of our applications includes references to different Intel developer's D: drives, e.g.

;D:\users\nbtester\x86win_nightly\branch-11_1\20100415_000000\libdev\libm\real\pow_sse2.c;___libm_sse2_pow

0 Kudos
Om_S_Intel
Employee
383 Views
The /Zi compiler option is supposed to generate debug symbol.

0 Kudos
Dale_S_Intel
Employee
383 Views
To clarify, if you remove /Zi from the command line, you're still seeing the debug info in the executable, correct?

Thanks!
Dale
0 Kudos
petervk
Beginner
383 Views
To clarify, if you remove /Zi from the command line, you're still seeing the debug info in the executable, correct?

Correct. There is no difference in the included executable file symbols when /Zi is present or not. The pdb file is not created when /Zi is not present, but the symbol info still appears in the executable. In real-world applications, however, the order the function symbols appear in the executable changes when /Zi is or is not specified.

0 Kudos
Reply