> From: Robert Bonomi <bon...@mail.r-bonomi.com> > To: freebsd-questions@freebsd.org > Cc: > Sent: Wednesday, May 2, 2012 6:38 AM > Subject: Re: Segmentation fault in FreeBSD 9.0 flockfile () > > > Unga <unga...@yahoo.com> wrote; >> From: Darren Baginski <kick...@yandex.com> >> > Unga <unga...@yahoo.com> wrote: >> > >> >01.05.2012, 22:08, "Unga" <unga...@yahoo.com>: >> >> Hi all >> >> >> >> I'm getting a Segmentation fault in FreeBSD 9.0 as follows > for myprog.c: >> >> >> >> Reading symbols from /libexec/ld-elf.so.1...done. >> >> Loaded symbols for /libexec/ld-elf.so.1 >> >> #0 0x28ebb062 in flockfile () from /lib/libc.so.7 >> >> [New Thread 29c04900 (LWP 100575/SDLTimer)] >> >> [New Thread 29c04300 (LWP 100416/myprog)] >> >> (gdb) >> >> (gdb) info threads >> >> * 2 Thread 29c04300 (LWP 100416/myprog) 0x28ebb062 in flockfile > () >> >> from /lib/libc.so.7 >> >> 1 Thread 29c04900 (LWP 100575/SDLTimer) 0x28e1527b in _umtx_op > () >> >> from /lib/libc.so.7 >> >> (gdb) >> >> >> >> I don't use flockfile () directly in my program. >> >> >> > >> >Hi! >> > >> >Mind to share code snippet caused the problem? >> >> Hi Thanks for the reply. I have mentioned in my original post that neithe >> r I nor SDL use the flockfile () in the source. >> > > There was a _reason_ the prior poster asked about seeing your code. > The information you provided is not adequate/sufficient for anyone to > have any chance of helping you. Informationn that -is- necessary was > therefore requested. > > What you "don't use" is irrelevant to solving the problem. > > To be any help one must figure out what you _did_ do -- which =indirectly= > calls flockfile(). > > Your code calls "something" in 'libc' that calls flockfile(). > > You "don't know" what that something in your code is. Other eyes > _might_ > recognize it, -if- they saw what you were doing. > > Here is how to find out what does that calling, yourself. > 1) recompile all the components of 'myprog' with the '-g' > compiler option. > 2) start 'script', so that you have a complete log of the debugger > session. > 3) load the debugger with 'myprog' as the program to be debugged. > 4) set a breakpoinnt in the 'flockfile' function > 5) 'run' the program > 6) when it stops at flockfile() entry. use 'where' to see a stack trace. > 7) 'display' each of the arguments to flockfile(). > 9) go 'up' to the calling code. > 9) repeat steps 7 and 8 util you reach 'your' code. > 10) now 'continue' the program. If it immediately segfaults, this was > the > offending call. Otherwise, the program will stop aggain at another > flockfile() invocation. repeat from step 7 -until- you get the segfault. > > If, from that debugger session, you still don't see anything wrong, post > the log of the debugger session. > > There is a *remote* possibility that the program will run properly under > the debugger, while it crashes when run directly. This has been known > to happen when a program _uses_ a variable before initializing it. > > *IF* that happens, you will have to modify 'myprog' to add diagnostic > output before and after each identified point (above) in your code that > indirectly invokes flockfile() to find which is failing. > > In _that_ event, you =will= have to post the 'relevant' source-code from > 'myprog', with the failing statement identified. > Hopefully I have not offended anyone with my reply :) Very sorry if I did.
My this FreeBSD 9.0 box is seems very messy. I have another issue that getaddrinfo(3) doesn't accept "localhost". After installing FreeBSD 9.0, I installed KDE, then realised that the existing Intel display driver does not support my Intel Sandy Bridge based GPU. So I had to patch the kernel to support KMS based latest Intel driver, upgraded to Xorg to 7.5.2, etc. etc. Whole process was done multiple times as I was new to this complex upgrade. I presume, I should erase off the hard disk and reinstall everything cleanly and then retry my programs on FreeBSD 9.0. If the problem still persists, I'll surely do a detailed debug. Pls note, whole thing works well on FreeBSD 8.1. As this is time consuming and as per existing commitments, I only try this at least in another two weeks time. I will sure let the list know the outcome. Best regards Unga _______________________________________________ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"