Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Seg fault even though address space is accessible

Reply
Thread Tools

Seg fault even though address space is accessible

 
 
Ajay
Guest
Posts: n/a
 
      07-30-2008
On Jul 29, 8:22*pm, Ben Bacarisse <(E-Mail Removed)> wrote:
> Ajay <(E-Mail Removed)> writes:
> > Thanks for your replay!
> > I was using malloc but after the error appeared, I tried using calloc.
> > I changed back the code to using malloc.
> > The Seg. fault error still persists.
> > The new code is posted below:

>
> Are you sure you are posting code you have compiled?
>
> > int
> > checkBFVectorList(bitfieldItemStruct **BFVecList, unsigned int BFlen)
> > int
> > buildBFVectorList(char *BFStr, bitfieldItemStruct **BFVecList)

>
> elsewhere you posted:
>
> | main()
> | {
> | * ****
> | *buildBFVectorList(currPeerDetailItem->bitfieldStr,
> | &(currPeerDetailItem->bitfieldVector));
> | *checkBFVectorList(currPeerDetailItem->bitfieldVector,
> | currPeerDetailItem->bitfieldLength);
> |
> | ****
> |
> | }
>
> The types here do not match up -- the compiler should reject it.
>
> --
> Ben.


Yes, you are right. The compiler did gave warning which I did not
notice.

Thanks a lot!
-Ajay.
 
Reply With Quote
 
 
 
 
Antoninus Twink
Guest
Posts: n/a
 
      07-30-2008
On 29 Jul 2008 at 22:29, Richard Heathfield wrote:
> Ajay said:
>> I got a segmentation fault while accessing a structure element.
>> I pasted the output from gdb and the backtrace.

>
> There's a guy around here somewhere who can debug your problem (no matter
> what it is) using only the debugger. Impressive. But if by some strange
> chance he doesn't have time to answer your question, you'll have to rely
> on the rest of us, and I'm afraid we tend to need to see the source code.


Yes Heathfield, very amusing, how we all admire your cleverness and wit.

Fact is, *noone* has claimed to be able to debug code using only a
debugger and not seeing the source code. *You* on the other hand (and
many of your lackeys and lickspittles) have claimed on many occasions
that you can debug any problem using only a printout of the source code
and never a debugger. I call bullshit on that.

 
Reply With Quote
 
 
 
 
Richard
Guest
Posts: n/a
 
      07-30-2008
Antoninus Twink <(E-Mail Removed)> writes:

> On 29 Jul 2008 at 22:29, Richard Heathfield wrote:
>> Ajay said:
>>> I got a segmentation fault while accessing a structure element.
>>> I pasted the output from gdb and the backtrace.

>>
>> There's a guy around here somewhere who can debug your problem (no matter
>> what it is) using only the debugger. Impressive. But if by some strange
>> chance he doesn't have time to answer your question, you'll have to rely
>> on the rest of us, and I'm afraid we tend to need to see the source code.

>
> Yes Heathfield, very amusing, how we all admire your cleverness and
> wit.


He really is an arrogant twit.

>
> Fact is, *noone* has claimed to be able to debug code using only a
> debugger and not seeing the source code. *You* on the other hand (and


Exactly.

> many of your lackeys and lickspittles) have claimed on many occasions
> that you can debug any problem using only a printout of the source code
> and never a debugger. I call bullshit on that.


Me too. Now cue one of his sycophantic friends to quote Kernighan or
somesuch telling us how much more difficult it is to debug a system than to
program it correctly the first time. Sigh.

 
Reply With Quote
 
Flash Gordon
Guest
Posts: n/a
 
      07-30-2008
Richard wrote, On 30/07/08 19:18:
> Antoninus Twink <(E-Mail Removed)> writes:
>
>> On 29 Jul 2008 at 22:29, Richard Heathfield wrote:
>>> Ajay said:
>>>> I got a segmentation fault while accessing a structure element.
>>>> I pasted the output from gdb and the backtrace.


<snip>

>> many of your lackeys and lickspittles) have claimed on many occasions
>> that you can debug any problem using only a printout of the source code
>> and never a debugger. I call bullshit on that.

>
> Me too. Now cue one of his sycophantic friends to quote Kernighan or
> somesuch telling us how much more difficult it is to debug a system than to
> program it correctly the first time. Sigh.


Obviously the person who managed to identify the bugs from just a couple
of snippets in this thread really managed to get hold of the entire
source without the rest of us seeing it.
--
Flash Gordon
Yes, I know, I should not reply to trolls.
 
Reply With Quote
 
Richard
Guest
Posts: n/a
 
      07-30-2008
Flash Gordon <(E-Mail Removed)> writes:

> Richard wrote, On 30/07/08 19:18:
>> Antoninus Twink <(E-Mail Removed)> writes:
>>
>>> On 29 Jul 2008 at 22:29, Richard Heathfield wrote:
>>>> Ajay said:
>>>>> I got a segmentation fault while accessing a structure element.
>>>>> I pasted the output from gdb and the backtrace.

>
> <snip>
>
>>> many of your lackeys and lickspittles) have claimed on many occasions
>>> that you can debug any problem using only a printout of the source code
>>> and never a debugger. I call bullshit on that.

>>
>> Me too. Now cue one of his sycophantic friends to quote Kernighan or
>> somesuch telling us how much more difficult it is to debug a system than to
>> program it correctly the first time. Sigh.

>
> Obviously the person who managed to identify the bugs from just a
> couple of snippets in this thread really managed to get hold of the
> entire source without the rest of us seeing it.


I'm not sure what your point is. This is usenet. The code needed was
small. It in no way invalidates the benefits a debugger brings. Or in
this case paying attention to compiler warnings. of course some people
pulled the "can't compile it so cant help" line. others read the
code. Which was not insurmountable since it was about 20 lines.

 
Reply With Quote
 
Chris Dollin
Guest
Posts: n/a
 
      07-31-2008
Antoninus Twink wrote:

> On 29 Jul 2008 at 22:29, Richard Heathfield wrote:
>> Ajay said:
>>> I got a segmentation fault while accessing a structure element.
>>> I pasted the output from gdb and the backtrace.

>>
>> There's a guy around here somewhere who can debug your problem (no matter
>> what it is) using only the debugger. Impressive. But if by some strange
>> chance he doesn't have time to answer your question, you'll have to rely
>> on the rest of us, and I'm afraid we tend to need to see the source code.

>
> Yes Heathfield, very amusing, how we all admire your cleverness and wit.
>
> Fact is, *noone* has claimed to be able to debug code using only a
> debugger and not seeing the source code. *You* on the other hand (and
> many of your lackeys and lickspittles) have claimed on many occasions
> that you can debug any problem using only a printout of the source code
> and never a debugger.


Cite three instances that fit this claim.

--
'It changed the future .. and it changed us.' /Babylon 5/

Hewlett-Packard Limited registered office: Cain Road, Bracknell,
registered no: 690597 England Berks RG12 1HN

 
Reply With Quote
 
Keith Thompson
Guest
Posts: n/a
 
      07-31-2008
Chris Dollin <(E-Mail Removed)> writes:
> Antoninus Twink wrote:

[more of the same]

> Cite three instances that fit this claim.


Chris, why on Earth would you ask a troll to post *more* crap?

--
Keith Thompson (The_Other_Keith) http://www.velocityreviews.com/forums/(E-Mail Removed) <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
 
Reply With Quote
 
Chris Dollin
Guest
Posts: n/a
 
      07-31-2008
Keith Thompson wrote:

> Chris Dollin <(E-Mail Removed)> writes:
>> Antoninus Twink wrote:

> [more of the same]
>
>> Cite three instances that fit this claim.

>
> Chris, why on Earth would you ask a troll to post *more* crap?


Paranoid terror that some poor sod will believe their
hysterically extreme claims.

(Additional evidence suggests I'm on a downer at the moment.)

--
'It changed the future .. and it changed us.' /Babylon 5/

Hewlett-Packard Limited registered no:
registered office: Cain Road, Bracknell, Berks RG12 1HN 690597 England

 
Reply With Quote
 
CBFalconer
Guest
Posts: n/a
 
      07-31-2008
Chris Dollin wrote:
> Antoninus Twink wrote:
>

.... snip ...
>
>> Fact is, *noone* has claimed to be able to debug code using only
>> a debugger and not seeing the source code. *You* on the other
>> hand (and many of your lackeys and lickspittles) have claimed on
>> many occasions that you can debug any problem using only a
>> printout of the source code and never a debugger.

>
> Cite three instances that fit this claim.


Well, answering the twinkletroll is pointless. However, many have
performed this awesome feat of legerdomain and successfully patched
the object code. It does require understanding machine code. It
may also require understanding the structure of the loadable code
module.

Admittedly, it is somewhat harder than reading source.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.


 
Reply With Quote
 
Ajay
Guest
Posts: n/a
 
      07-31-2008
On Jul 31, 9:58*am, CBFalconer <(E-Mail Removed)> wrote:
> Chris Dollin wrote:
> > Antoninus Twink wrote:

>
> ... snip ...
>
> >> Fact is, *noone* has claimed to be able to debug code using only
> >> a debugger and not seeing the source code. *You* on the other
> >> hand (and many of your lackeys and lickspittles) have claimed on
> >> many occasions that you can debug any problem using only a
> >> printout of the source code and never a debugger.

>
> > Cite three instances that fit this claim.

>
> Well, answering the twinkletroll is pointless. *However, many have
> performed this awesome feat of legerdomain and successfully patched
> the object code. *It does require understanding machine code. *It
> may also require understanding the structure of the loadable code
> module.
>
> Admittedly, it is somewhat harder than reading source.
>
> --
> *[mail]: Chuck F (cbfalconer at maineline dot net)
> *[page]: <http://cbfalconer.home.att.net>
> * * * * * * Try the download section.


Thanks for all your replays and time.
The Seg fault is now resolved. Just a summary.

I was making two big blunders.
1. I was passing pointer to a structure instead of pointer to pointer
of a structure.
2. I was allocating memory to a pointer to structure instead of
structure.

They just creeped in due to my 'lazy programming'.

I am posting gcc compiled code.
Since I was using strict compiler options (including -ansi -pedantic)
and throwing out all the warnings.
So I was ignoring the argument mis-match warnings along with other
warnings.

I haven't figured out what are best compiler options yet.
But I can make sure next time that I go thru the list warning msgs.

Thanks,
Ajay.









 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CPU Usage frequently 100% even though it seems not even close tototal memory Newcomer Computer Support 3 11-15-2009 06:51 AM
CPU Usage frequently 100% even though it seems not even close tototal memory Newcomer Computer Support 0 11-14-2009 11:21 PM
Wireless adapter losing network address even though signal is strong... Howard Woodard Wireless Networking 2 07-11-2009 07:21 PM
seg fault because stdexcept.cc not found? Corrine C++ 1 11-27-2003 06:15 AM
Suprising seg fault!!! Vinod C++ 3 09-27-2003 02:43 PM



Advertisments