- 论坛徽章:
- 0
|
- 1 #include "stdio.h"
- 2
- 3 int main(){
- 4 int a[] = {1,2,3,4,5,28,4};
- 5 return 0;
- 6 }
复制代码
- (gdb) b 4
- Breakpoint 1 at 0x8048366: file array_assign.c, line 4.
- (gdb) run
- Starting program: /home/project/example/array_assign
- Reading symbols from shared object read from target memory...done.
- Loaded system supplied DSO at 0xb85000
- Breakpoint 1, main () at array_assign.c:4
- 4 int a[] = {1,2,3,4,5,28,4};
- (gdb) p a
- $1 = {-1074379060, -1074379208, 134513566, 7417844, 1, 0, 7417844}
- (gdb) s
- 5 return 0;
- (gdb) p a
- $2 = {1, 2, 3, 4, 5, 28, 4}
- (gdb)
复制代码
在第4行设置断点的话,我觉得应该是这一句还没有执行,所以数组中的值是任意的。
不知道这样理解正不正确 |
|