C/C++Eclipse GDB没有显示断点

C/C++ Eclipse GDB not showing break points

本文关键字:显示 断点 GDB C++Eclipse      更新时间:2023-10-16

当我试图在Eclipse中调试代码时,它似乎运行调试器并停止,但Eclipse无法找到源代码?打开一个选项卡,上面写着"main()at 0x100000f64",按钮上写着"查看反汇编"

我可以很好地查看反汇编,但如果我能让断点工作,那就太好了。谢谢

我的代码:

#include <iostream>
using namespace std;
int main() {
   int n = 10;
   int factorial = 1;
   // n! = 1*2*3...*n
   for (int i = 1; i <= n; i++) {
      cout << "i is " << i << endl;
      factorial *= i;
   }
   cout << "The Factorial of " << n << " is " << factorial << endl;
   return 0;
}

GDB警告输出:

warning: `/var/folders/s1/dxx9glzn45j6x2ypzk9xkjnc0000gp/T/Test-203d73.o': can't open to read symbols: No such file or directory.
$1 = 0xff
The target endianness is set automatically (currently little endian)
No symbol table is loaded.  Use the "file" command.
warning: Could not open OSO archive file "/BinaryCache/Libsyscall/Libsyscall-2422.110.17~1/Symbols/BuiltProducts/libsystem_kernel.a"
warning: `/private/var/tmp/Libsyscall/Libsyscall-2422.110.17~1/Libsyscall.build/Libsyscall_dynamic.build/Objects-normal/x86_64/_libc_funcptr.o': can't open to read symbols: No such file or directory.
warning: `/private/var/tmp/Libsyscall/Libsyscall-2422.110.17~1/Libsyscall.build/Libsyscall_dynamic.build/Objects-normal/x86_64/kernel_vers.o': can't open to read symbols: No such file or directory.
warning: `/private/var/tmp/Libsyscall/Libsyscall-2422.110.17~1/Libsyscall.build/Libsyscall_dynamic.build/Objects-normal/x86_64/memcpy.o': can't open to read symbols: No such file or directory.
warning: `/private/var/tmp/Libsyscall/Libsyscall-2422.110.17~1/Libsyscall.build/Libsyscall_dynamic.build/Objects-normal/x86_64/strcmp.o': can't open to read symbols: No such file or directory.
warning: `/private/var/tmp/Libsyscall/Libsyscall-2422.110.17~1/Libsyscall.build/Libsyscall_dynamic.build/Objects-normal/x86_64/strlcpy.o': can't open to read symbols: No such file or directory.
warning: `/private/var/tmp/Libsyscall/Libsyscall-2422.110.17~1/Libsyscall.build/Libsyscall_dynamic.build/Objects-normal/x86_64/strlen.o': can't open to read symbols: No such file or directory.
warning: Could not open OSO archive file "/BinaryCache/libplatform/libplatform-24.90.1~2/Symbols/libatomics_normal.a"
warning: Could not open OSO archive file "/BinaryCache/libplatform/libplatform-24.90.1~2/Symbols/libcachecontrol_normal.a"
warning: Could not open OSO archive file "/BinaryCache/libplatform/libplatform-4.90.1~2/Symbols/libos_normal.a"
warning: Could not open OSO archive file "/BinaryCache/libplatform/libplatform-24.90.1~2/Symbols/libsetjmp_normal.a"
warning: Could not open OSO archive file "/BinaryCache/libplatform/libplatform-24.90.1~2/Symbols/libsimple_normal.a"
warning: Could not open OSO archive file "/BinaryCache/libplatform/libplatform-24.90.1~2/Symbols/libstring_normal.a"
warning: Could not open OSO archive file "/BinaryCache/libplatform/libplatform-24.90.1~2/Symbols/libucontext_normal.a"
warning: `/private/var/tmp/libplatform/libplatform-24.90.1~2/libplatform.build/libsystem_platform.build/Objects-normal/x86_64/init.o': can't open to read symbols: No such file or directory.
Temporary breakpoint 2, 0x0000000100000f64 in main ()
Single stepping until exit from function main,
which has no line number information.
Single stepping until exit from function start,
which has no line number information.
[Inferior 1 (process 84739) exited normally]
Quit
`

我也想出了这个。。问题是,当你创建项目时,你需要确保它使用的是Mac GCC而不是llvm来编译。目前,如果使用llvm编译,似乎无法使用gdb进行调试:)