当我尝试在Eclipse中调试代码时,似乎运行调试器并停止但是Eclipse无法找到源代码?打开一个标签,显示" main()位于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
`
答案 0 :(得分:0)
我也想到了这个。问题是,当你创建项目时,你需要确保它使用Mac GCC而不是llvm进行编译。目前,如果使用llvm进行编译,似乎无法使用gdb进行调试:)