|
Home > Archive > Unix Programming > March 2004 > Segmentation fault need help
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Segmentation fault need help
|
|
| Marcia Hon 2004-02-15, 10:34 am |
| Hi,
I am trying to run a program except I get the following segmentation fault.
I don't know how to solve it. Please if you know could you please help.
Thanks, Marcia
Program received signal SIGSEGV, Segmentation fault.
0x0a6e6962 in ?? ()
(gdb) bt
#0 0x0a6e6962 in ?? ()
Cannot access memory at address 0xa6d6461
(gdb)
| |
| newsgroup user 2004-02-15, 10:34 am |
| "Marcia Hon" <honm@rogers.com> writes:
> Hi,
>
> I am trying to run a program except I get the following segmentation fault.
> I don't know how to solve it. Please if you know could you please help.
>
> Thanks, Marcia
>
> Program received signal SIGSEGV, Segmentation fault.
>
> 0x0a6e6962 in ?? ()
>
> (gdb) bt
>
> #0 0x0a6e6962 in ?? ()
>
> Cannot access memory at address 0xa6d6461
You have a corrupted stack. Look for buffer overflows in
automatically allocated memory. Another typical cause is freeing
automatic memory. It could also be caused by using an uninitialized
pointer. A memory debugger like Electric Fence or (for PC) valgrind
is useful for finding such bugs.
--
Måns Rullgård
mru@kth.se
| |
| Paul Pluzhnikov 2004-02-15, 1:33 pm |
| mru@kth.se (Måns Rullgård) writes:
> "Marcia Hon" <honm@rogers.com> writes:
Note that this is ASCII: "\nnib", doing "x/s $esp" may reveal the
rest of the string which overflowed its buffer.
[color=blue]
> You have a corrupted stack.
Most definitely.
> Look for buffer overflows in automatically allocated memory.
Yes. I would bet 10:1 that this is a simple strcpy() into an
automatic char array that is too small.
> Another typical cause is freeing automatic memory.
That would cause a SIGSEGV *in* malloc/free, not a jump to ASCII.
> It could also be caused by using an uninitialized pointer.
Or it could be that.
> A memory debugger like Electric Fence or (for PC) valgrind
> is useful for finding such bugs.
EFence will not help with this kind of bug at all, valgrind might
(if this is an uninitialized pointer, but not otherwize).
Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
| |
| CBFalconer 2004-02-16, 7:34 am |
| Marcia Hon wrote:
>
> I am trying to run a program except I get the following segmentation fault.
> I don't know how to solve it. Please if you know could you please help.
You are getting out of hand. Please STOP the excessive
cross-posting, and STOP posting OT matter, and START posting
cut-down compilable complete programs not exceeding 100 lines when
you need help. Failing this I suggest wholesale PLONKING, after
which you will not be able to get help anywhere.
For you, anything over one newsgroup is excessive crossposting.
--
Chuck F (cbfalconer@yahoo.com) (cbfalconer@worldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!
| |
| Marcia Hon 2004-02-16, 4:33 pm |
| Thanks.
I don't know how to solve it your way. I would like to learn. I, however,
solved it by sequentially putting printfs throughout the program!
Thanks again for your help.
Marcia
| |
| nikhil bhargav 2004-03-17, 9:46 am |
| CBFalconer <cbfalconer@yahoo.com> wrote in message news:<403108D1.50786BF7@yahoo.com>...
> Marcia Hon wrote:
>
> You are getting out of hand. Please STOP the excessive
> cross-posting, and STOP posting OT matter, and START posting
> cut-down compilable complete programs not exceeding 100 lines when
> you need help. Failing this I suggest wholesale PLONKING, after
> which you will not be able to get help anywhere.
>
> For you, anything over one newsgroup is excessive crossposting.
Pleae avoid cross postng as it goes against spirit of user groups and
discusson forums. Instead try to post ur code if its small or uload it
somewhere and give its link, so that ppl could read it and give their
suggestions.
SIGSEV is given when a user level process tries to read/write/free a
mem region which doesnot belong to its user stack.
nikhil
|
|
|
|
|