Re: Problem Debugging C Program
- From: John Hanley <hanley@xxxxxxxxxxx>
- Date: Tue, 28 Aug 2007 13:28:36 -0600
Willem wrote:
John wrote:
) I am having some problems debugging my program. I am getting a SIGSEGV.
)
) I have a linked list. I am reading in data from a text file, storing the ) data in a linked list, and printing out the linked list.
)
) I step through the program with GDB/DDD and everything seems to get ) parsed and stored correctly. Even when I print out my linked list, just ) before my printf statement I check the values in my list node and the ) values are fine. When I execute the printf, I get a SIGSEGV. I did a ) 'where' in GDB and got this:
)
) Program received signal SIGSEGV, Segmentation fault.
) 0x006ab7ab in _IO_default_xsputn_internal () from /lib/libc.so.6
) (gdb) where
) #0 0x006ab7ab in _IO_default_xsputn_internal () from /lib/libc.so.6
) #1 0x006a91d5 in _IO_new_file_xsputn () from /lib/libc.so.6
) #2 0x006860a9 in vfprintf () from /lib/libc.so.6
) #3 0x0068e2b7 in printf () from /lib/libc.so.6
) #4 0x08049694 in print_list (l=0x8cf3170) at intrp_time.c:466
) #5 0x0804990b in extract_records (f=0x8cf3008) at intrp_time.c:552
) #6 0x08049afb in main (argv=Cannot access memory at address 0x39303a30
) ) at intrp_time.c:615
)
) I am not sure what argv has to do with anything. Does anyone have any ) suggestions as to where I can start looking for this problem?
You may have trashed your stack somewhere, causing the argv thingy.
Anyway, it looks like you called printf with a dangling pointer.
I replaced my printf with a simple printf("hello world"). And it still trips the SIGSEGV at that point.
Any other suggestions?
Thanks.
.
- Follow-Ups:
- Re: Problem Debugging C Program
- From: Willem
- Re: Problem Debugging C Program
- References:
- Problem Debugging C Program
- From: John Hanley
- Re: Problem Debugging C Program
- From: Willem
- Problem Debugging C Program
- Prev by Date: Re: Problem Debugging C Program
- Next by Date: Re: Problem Debugging C Program
- Previous by thread: Re: Problem Debugging C Program
- Next by thread: Re: Problem Debugging C Program
- Index(es):
Relevant Pages
|