即使地址空间可访问,也会出现段错误 [英] Seg fault even though address space is accessible

查看:56
本文介绍了即使地址空间可访问,也会出现段错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


访问结构元素时出现分段错误。

我粘贴了gdb和backtrace的输出。


但是,如果我能够使用gdb输出中的

地址成功访问该结构

之后出现seg故障。 gdb的输出也在下面给出。


任何想法都会发生这种情况吗?

是的我试图访问它所在的结构元素

出错。


我肯定遗漏了什么。

感谢任何帮助!


谢谢,

Ajay。


$$$$$$$$$$$$$ SEG FAULT $$$$$$$$$$ $$$$$$


程序收到信号SIGSEGV,分段错误。

checkBFVectorList(BFVecList = 0x84187a0,BFlen = 699)

at compute_sticky_IP_per_ASN.c:776

776 vector = vector-> nextVector;


$$$$$$$$$$$$ $$$ BT $$$$$$$$$$$$$$$$$$$$


(gdb)bt

#0 checkBFVectorList(BFVecList = 0x84187a0,BFlen = 699)

at compute_sticky_IP_per_ASN.c:776

#1 0x08051bb3 in buildPeerDetailStructFromLine(line = 0x8418dd0" 566",

peerStruct = 0x8047124)at compute_sticky_IP_per_ASN.c:752

#2 0x080522c1 in m ain(argc = 11,argv = 0x8047348)

at compute_sticky_IP_per_ASN.c:179


$$$$$$$$$$$$$ $$$$$$ ACCESSING STRUCTURE $$$$$$$$$$$$$$$$$$$

(gdb)p *(bitfieldItemStruct *)0x84187a0

$ 1 = {BFVector = 3309413121,nextVector = 0x84187b0}

(gdb)p((bitfieldItemStruct *)0x84187a0) ​​- > nextVector

$ 2 =(struct bitfieldItem *)0x84187b0

(gdb)p((struct bitfieldItem *)0x84187a0) ​​- > nextVector

$ 3 =(struct bitfieldItem *)0x84187b0

Hi All,

I got a segmentation fault while accessing a structure element.
I pasted the output from gdb and the backtrace.

However if I am able successfully access the structure using the
address from the gdb output
after it seg faulted. Output from gdb also give below.

Any idea y this is happening?
yes I am trying to access the structure element from where it seg
faulted.

I am surely missing something.
Any help is appreciated!

Thanks,
Ajay.

$$$$$$$$$$$$$ SEG FAULT $$$$$$$$$$$$$$$$$

Program received signal SIGSEGV, Segmentation fault.
checkBFVectorList (BFVecList=0x84187a0, BFlen=699)
at compute_sticky_IP_per_ASN.c:776
776 vector = vector->nextVector;

$$$$$$$$$$$$$$$$ BT $$$$$$$$$$$$$$$$$$$$

(gdb) bt
#0 checkBFVectorList (BFVecList=0x84187a0, BFlen=699)
at compute_sticky_IP_per_ASN.c:776
#1 0x08051bb3 in buildPeerDetailStructFromLine (line=0x8418dd0 "566",
peerStruct=0x8047124) at compute_sticky_IP_per_ASN.c:752
#2 0x080522c1 in main (argc=11, argv=0x8047348)
at compute_sticky_IP_per_ASN.c:179

$$$$$$$$$$$$$$$$$$$$ ACCESSING STRUCTURE $$$$$$$$$$$$$$$$$$$

(gdb) p *(bitfieldItemStruct *) 0x84187a0
$1 = {BFVector = 3309413121, nextVector = 0x84187b0}
(gdb) p ((bitfieldItemStruct *) 0x84187a0)->nextVector
$2 = (struct bitfieldItem *) 0x84187b0
(gdb) p ((struct bitfieldItem *) 0x84187a0)->nextVector
$3 = (struct bitfieldItem *) 0x84187b0

推荐答案

赛格故障





程序接收信号SIGSEGV,分段错误。

checkBFVectorList(BFVecList = 0x84187a0,BFlen = 699)

at compute_sticky_IP_per_ASN.c:776

776 vector = vector-> nextVector;



Program received signal SIGSEGV, Segmentation fault.
checkBFVectorList (BFVecList=0x84187a0, BFlen=699)
at compute_sticky_IP_per_ASN.c:776
776 vector = vector->nextVector;


BT


这篇关于即使地址空间可访问,也会出现段错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆