[436911.689947] 1[17715]: segfault at 0 ip 080483e9 sp bfcfcbc0 error 6 in 1[8048000+1000]

#include <stdio.h>

func2()
{
    printf("func2 add:%p\n",func2);
    int *p=0;*p=0;
}
func1()
{
    printf("func1 add:%p\n",func1);
    func2();
}

int main()
{
    printf("main add:%p\n",main);
    int a;
    int b;
    printf("&a:%p &b:%p\n", &a, &b);
    func1();
    
}


./1
main add:0x8048413
&a:0xbfcfcc2c &b:0xbfcfcc28
func1 add:0x80483f1
func2 add:0x80483c4
core dumped

 PC:~/Desktop/ctest$ readelf -s 1 | grep main
    65: 08048413    66 FUNC    GLOBAL DEFAULT   14 main
 PC:~/Desktop/ctest$ readelf -s 1 | grep func
    56: 080483c4    45 FUNC    GLOBAL DEFAULT   14 func2
    61: 080483f1    34 FUNC    GLOBAL DEFAULT   14 func1

[436911.689947] 1[17715]: segfault at 0 ip 080483e9 sp bfcfcbc0 error 6 in 1[8048000+1000]

Program terminated with signal 11, Segmentation fault.
#0  0x080483e9 in func2 ()
(gdb) bt
#0  0x080483e9 in func2 ()
#1  0x08048411 in func1 ()
#2  0x08048453 in main ()
(gdb) q









[436911.689947] 1[17715]: segfault at 0 ip 080483e9 sp bfcfcbc0 error 6 in 1[8048000+1000]



~/Desktop/ctest$ gdb 1  core_1.17762
GNU gdb (GDB) 7.0.1-debian
Copyright (C) 2009 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 the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from  Desktop/ctest/1...(no debugging symbols found)...done.

warning: Can't read pathname for load map: Input/output error.
Reading symbols from /lib/i686/cmov/libc.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib/i686/cmov/libc.so.6
Reading symbols from /lib/ld-linux.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib/ld-linux.so.2
Core was generated by `./1'.
Program terminated with signal 11, Segmentation fault.
#0  0x080483e9 in func2 ()
(gdb) bt
#0  0x080483e9 in func2 ()
#1  0x08048411 in func1 ()
#2  0x08048453 in main ()








评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值