Re: Problem Debugging C Program



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.


SaSW, Willem
--
Disclaimer: I am in no way responsible for any of the statements
made in the above text. For all I know I might be
drugged or something..
No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT
.



Relevant Pages

  • Re: Problem Debugging C Program
    ... I replaced my printf with a simple printf. ... trips the SIGSEGV at that point. ... You all think I'm paranoid, ...
    (comp.programming)
  • Re: Problem Debugging C Program
    ... I am having some problems debugging my program. ... 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. ... I get a SIGSEGV. ... You may have trashed your stack somewhere, causing the argv thingy. ...
    (comp.programming)
  • debugging c program
    ... I am having some problems debugging my program. ... 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. ... I get a SIGSEGV. ... I did a 'where' in GDB and got this: ...
    (comp.programming.threads)
  • Problem Debugging C Program
    ... I am having some problems debugging my program. ... 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. ... I get a SIGSEGV. ... I did a 'where' in GDB and got this: ...
    (comp.programming)