我对gdb有些麻烦.这是我在名为main.cpp的单个文件中的代码
#include <iostream>
void myfunc();
int main(){
char msg[] = "Hello World!";
myfunc();
std::cout << msg << std::endl;
return 0;
}
void myfunc(){
int boo = 16;
}
Run Code Online (Sandbox Code Playgroud)
我用这个命令来编译这段代码:
g++ -g -Wall main.cpp -o foo
Run Code Online (Sandbox Code Playgroud)
接下来,我使用了gdb:
$ gdb foo
(gdb) start
Temporary breakpoint 1 at 0x80487c3
Starting program: /home/laptop/workspace/foo
Temporary breakpoint 1, 0x080487c3 in main ()
(gdb) s
Single stepping until exit from function main,
which has no line number information.
Hello World!
__libc_start_main (main=0x80487c0 <main>, argc=1, ubp_av=0xbffff3a4, init=0x80488b0 <__libc_csu_init>, …Run Code Online (Sandbox Code Playgroud)