0

I don't know how to add debugging symbols to my compiled C code on windows. My attempt so far is below.

My test code:

#include <stdio.h>
#include <stdlib.h>

int main()
{
    printf("Hello world!\n");

    return EXIT_SUCCESS;
}

My compilation attempts

icl.exe main.c /debug -o testmain.exe
icl.exe main.c /debug /Z7 -o testmain.exe
icx.exe main.c /debug /Z7 -o testmain.exe
icl.exe main.c /debug /Zi -o testmain.exe

My execution

gdb-oneapi testmain.exe

The compilation generates three files: .exe, .ilk, .pdb. gdb complains that no symbols have been found in the exe.

DJames
  • 571
  • 3
  • 17
  • See https://stackoverflow.com/questions/23515634/debugging-intel-compiled-project-with-gdb and https://stackoverflow.com/questions/40032013/debugging-intel-c-compiled-code-with-gdb both of which indicate that the Intel compiler doesn't generate the debugger output needed by gdb. However see this toolkit https://www.intel.com/content/www/us/en/developer/tools/oneapi/distribution-for-gdb.html#gs.y1596p – Richard Chambers May 18 '23 at 23:52
  • It was the intel gdb distribution that originally gave me hope. "gdb-oneapi" works fine on linux but seems to fail on windows. – DJames May 19 '23 at 00:06

1 Answers1

2

We suggest you use the Visual Studio debugger to debug the C/C++ applications.
On the Windows platform, the Intel C/C++ compiler is compatible with the Microsoft toolchain. Please refer to the below link.
https://www.intel.com/content/www/us/en/docs/dpcpp-cpp-compiler/developer-guide-reference/2023-1/microsoft-compatibility.html

And thus emits debugging information in a format compatible with Visual Studio and the VS debugger. This format is not supported by gdb-oneapi.
On Windows, gdb-oneapi provides Visual Studio integration that supports debugging of code offloaded to a GPU. Please refer to the below link.
https://www.intel.com/content/www/us/en/docs/oneapi/user-guide-vs-code/2023-1/gdb-gpu-support-for-intel-oneapi-toolkits.html

For additional references:
https://www.intel.com/content/www/us/en/docs/distribution-for-gdb/get-started-guide-windows/2023-1/overview.html
https://www.intel.com/content/www/us/en/docs/distribution-for-gdb/tutorial-debugging-dpcpp-windows/2023-1/overview.html

SeshaP-Intel
  • 129
  • 5