linux 单步运行
$ g++ 272.cpp -g
$ gdb a.out
(gdb) l
2 #include <string>
3
4 using namespace std;
5
6 #define sam 25
7
8
9 int main()
10 {
11 int numbers[sam] = {0};
(gdb) 6
Undefined command: "6". Try "help".
(gdb) b 6
Breakpoint 1 at 0x4008a5: file 272.cpp, line 6.
(gdb) r
Starting program: /home/sam/python/c++/a.out
Breakpoint 1, main () at 272.cpp:11
11 int numbers[sam] = {0};
(gdb) n
12 cout << "sizeof of numbers is:" << sizeof(numbers) << endl;
(gdb) n
sizeof of numbers is:100
16 return 0;
(gdb) n
18 }
(gdb) n
__libc_start_main (main=0x40089d <main()>, argc=1, argv=0x7fffffffe6c8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe6b8) at libc-start.c:321
321 libc-start.c: No such file or directory.
(gdb) n
[Inferior 1 (process 18115) exited normally]
(gdb) n
The program is not being run.
(gdb) n
The program is not being run.
(gdb) q
浙公网安备 33010602011771号