如何在 Windows 上使用英特尔的调试器 gdb-oneapi 读取文件?

问题描述

我要调试以下文件

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

int main()
{
        printf("Hello World!\n");
        return EXIT_SUCCESS;
}

我编译

icl.exe /debug:all main.c -o test

这会产生三个文件

test.exe
test.ikl
test.pdb

我尝试使用命令进行调试

gdb-oneapi
> file test.exe
> symbol-file test.pdb

它说 test.pdb 是一种无法识别的格式,而 test.exe 没有调试信息。

通过 linux 调试没有问题。为什么这个简单的过程在 Windows 上会失败?

解决方法

请参考以下链接

Debugging Intel C++ compiled code with GDB

如果存在微软命令行调试器,则可以支持在 Windows 中进行命令行调试。

https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/cdb-command-line-options