Hi, I'm speech recognition researcher not so fond of newer Linux systems. I have some old 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.
Robert Rozman wrote:
Hi,
I'm speech recognition researcher not so fond of newer Linux systems. I have some old 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
Sounds to me like you're maybe relying on deprecated libc-calls. libc has evolved over time, after all. fflush is still present though. Maybe the FILE* has gone wild somehow, eg. has been created with no longer supported system calls.
---------------- 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...
Can't help you there --- I'm still debugging "by hand" (printf ("ok\n"); /*code */; printf ("still ok\n"); .......) :-) Usually a segfault means you're accessing a memory segment you're not allowed to (or in a manner you're not allowed to). In this case that means the FILE* is probably pointing to a non-valid location.
Also any advice on this particular error would be appreciated.
See above. In general, you should first compile again with "-pedantic" and check all warnings/errors. After that, link with the "-static" option so you can see if the calls you use have changed their signature or have disappeared. Finally, gcc has changed and v. 3.4 is said to have dropped many things you could do in earlier versions. I've had problems after upgrading to 3.1 with inline ASM-code, since all multi-line-strings now require explicit "\n"'s.
Thanks in advance,
regards,
Robert.
HTH, Kolja
Robert wrote regarding '[SLE] Rusty oldtimer in gcc programming ...' on Mon, Sep 20 at 11:04:
Hi,
I'm speech recognition researcher not so fond of newer Linux systems. I have some old 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
Doesn't ddd have a memory map thingie that'd help with this? Can't you just set some breakpoints and examine pointers until you find the one that's screwy? I could swear that I used to use ddd when I wrote code in that antique language... :) Well, I'm not much help - but maybe if you look a little closer you'll find the stuff I'm referring to. Or maybe not. I dunno. --Danny, who needs a nap
participants (3)
-
Danny Sauer
-
Kolja Kauder
-
Robert Rozman