我得到了gdb brew install gdb.
源文件内容是:
#include <cstdio>
int main(){
int a = 10;
for(int i = 0; i< 10; i++){
a += i;
}
printf("%d\n",a);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
这是名为'demo'的可执行文件:https: //pan.baidu.com/s/1wg-ffGCYzPGDI77pRxhyaw
我像这样编译源文件:
c++ -g -o demo demo.cpp
Run Code Online (Sandbox Code Playgroud)
并运行gdb
gdb ./demo
Run Code Online (Sandbox Code Playgroud)
但是,它无法奏效.它无法识别可执行文件.
GNU gdb (GDB) 8.2
Copyright (C) 2018 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 …Run Code Online (Sandbox Code Playgroud)