Rusty oldtimer (newbie now) in gcc programming kindly ask for help
Hi, I'm speech recognition researcher not so fond of newer Linux systems. I have some old ansi C code that I used to run under Debian 2.0. Now I transferred code to Suse 9.0, compile it without any errors (some warnings) but get segmentation faults in runtime. One particular error is (I get this when run in ddd): Program received signal SIGSEGV, Segmentation fault. 0x400b90af in fflush() from /lib/libc.so.6 ---------------- My C knowledge is rusty (I checked up this code long time ago) so I'd kindly ask for some quick guidance, how to deal with such segfaults. If I remember right there were some tools that could help in debugging memory accesses (efence or something like that) - I guess tools are now much more advanced - but I don't know which one to use... Also any advice on this particular error would be appreciated. Thanks in advance, regards, Robert.
On Monday 20 September 2004 16:43, Robert Rozman wrote:
Hi, [...] One particular error is (I get this when run in ddd):
Program received signal SIGSEGV, Segmentation fault. 0x400b90af in fflush() from /lib/libc.so.6
fflush flushes out any open streams you may have. It must be trying to write to a stream that you somehow closed (never did anything too complicated with streams, so don't know for sure what the failure modes are, sorry...). Try eliminating any buffered io, just as a test. Your debugging will probably yield something more useful then. BTW, I assume you know how to trace the stack in ddd (or in gdb) right? 'back', in the gdb prompt (works in ddd too). Valgrind is a pretty cool utility for debugging memory accesses. It's easy to use, too. You may want to look into it. It's in the SuSE cds/dvd. Hope this helps! Adalberto
---------------- My C knowledge is rusty (I checked up this code long time ago) so I'd kindly ask for some quick guidance, how to deal with such segfaults. If I remember right there were some tools that could help in debugging memory accesses (efence or something like that) - I guess tools are now much more advanced - but I don't know which one to use...
Also any advice on this particular error would be appreciated.
Thanks in advance,
regards,
Robert.
Hi,
I'm speech recognition researcher not so fond of newer Linux systems. I have some old ansi C code that I used to run under Debian 2.0.
Now I transferred code to Suse 9.0, compile it without any errors (some warnings) but get segmentation faults in runtime.
One particular error is (I get this when run in ddd):
Program received signal SIGSEGV, Segmentation fault. 0x400b90af in fflush() from /lib/libc.so.6
---------------- My C knowledge is rusty (I checked up this code long time ago) so I'd kindly ask for some quick guidance, how to deal with such segfaults. If I remember right there were some tools that could help in debugging memory accesses(efence or something like that) - I guess tools are now much more advanced - but I don't know which one to use... As Adalberto mentions, valgrind is a good tool, especially for memory leaks. Segmentation faults in system libraries is usually a result of some prior memory allocation issue, such as addressing beyond the end of allocated memory or simply a bad pointer, in this case possibly to a FILE structure. Another (but expensive) tool is Rational's Purify. I recommended that to someone else who supplies an API where the customer was complaining about a memory leak. After several weeks of using other tools, he used Purify, which found the problem in 5 minutes. They were so impressed,
On Mon, 20 Sep 2004 22:43:58 +0200
"Robert Rozman"
participants (3)
-
Adalberto Castelo
-
Jerry Feldman
-
Robert Rozman