cgdbintel-oneapi

gdb-oneapi "No debugging symbols found in <exe>"


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.


Solution

  • 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