qq_36179095
淡怀
2017-10-31 15:55

段错误,求大神解释一下

  • 段错误

6 int main(void) {
(gdb) n
7 char arr[] = "hello";
(gdb) n
8 char *p = "world";
(gdb) n
9 printf("pid:%d\n",getpid());
(gdb) n
pid:10709
10 printf("&arr:%p\n&p:%p\nworld:%p\nhello:%p\n",&arr,&p,p,"hello");
(gdb) n
&arr:0x7fffffffdff0
&p:0x7fffffffdfe8
world:0x400810
hello:0x400841
11 printf("arr:%s\n",arr);
(gdb) n
arr:hello
12 printf("p:%s\n",p);
(gdb) n
p:world
13 strcpy(p,arr);
(gdb) n

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7ab14e6 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) n
Cannot find bounds of current function
(gdb) n

0x00007ffff7ab14e6这个地址是什么意思,这个是虚拟地址?系统想告诉我这个虚拟地址没有对应的物理地址?

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答

为你推荐

换一换