我知道
未加载符号表。使用“文件”命令。 当我运行gdb
main.exe
我正在尝试使用您可以想象的c ++调试最简单的程序。 将Bazel用作构建系统后,我无法调试。
#include <iostream>
int main()
{
int a = 3;
int b = 5;
int c = a + b;
/* code */
std::cout << "Hello world" << std::endl;
std::cout << c << std::endl;
return 0;
}
要构建二进制文件,请运行:
bazel build // src / app:main --run_under = gdb
然后我跑:
gdb main.exe
我得到这个输出
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
PS C:\dev\tests\cpp_tests\bazel-tests\bazel-bin\src\app> gdb main.exe
GNU gdb (GDB) 7.6.1
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
"C:\dev\tests\cpp_tests\bazel-tests\bazel-bin\src\app/main.exe": not in executable format: File format not recognized
(gdb) start
No symbol table loaded. Use the "file" command.
(gdb)
如果我跑步:
./main.exe
我明白了
PS C:\dev\tests\cpp_tests\bazel-tests\bazel-bin\src\app> ./main.exe
Hello world
8
PS C:\dev\tests\cpp_tests\bazel-tests\bazel-bin\src\app>
Bazel发生了什么事?