From owner-freebsd-questions@FreeBSD.ORG Wed May 2 19:00:04 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DD6F3106564A for ; Wed, 2 May 2012 19:00:04 +0000 (UTC) (envelope-from unga888@yahoo.com) Received: from nm39-vm2.bullet.mail.bf1.yahoo.com (nm39-vm2.bullet.mail.bf1.yahoo.com [72.30.239.146]) by mx1.freebsd.org (Postfix) with SMTP id 834828FC12 for ; Wed, 2 May 2012 19:00:04 +0000 (UTC) Received: from [98.139.214.32] by nm39.bullet.mail.bf1.yahoo.com with NNFMP; 02 May 2012 18:59:57 -0000 Received: from [98.139.212.196] by tm15.bullet.mail.bf1.yahoo.com with NNFMP; 02 May 2012 18:59:57 -0000 Received: from [127.0.0.1] by omp1005.mail.bf1.yahoo.com with NNFMP; 02 May 2012 18:59:57 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 825460.93357.bm@omp1005.mail.bf1.yahoo.com Received: (qmail 76194 invoked by uid 60001); 2 May 2012 18:59:57 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1335985197; bh=eX7JZGpZQARoKCUE2OABdfh/qB535BqLR7bWBb3NZ+M=; h=X-YMail-OSG:Received:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=lftoMxz5nMXcn3ihaw+wB8iqtK1O9TEL9pl1p5DAINuSxVH0i4Zu8877Aw8pOGfjKvgmS0STmXOY6qgBsMS3UeR6vmsiA1QiGoHcCIzhxGDos84zf88n0Jd2qEhfepmQRTLli9IbbBZiuScabETzziUQLO7B/CFTHeUYwsiK+nI= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=ZjLgU8TsUAy8QV7W/z70HHsr0aBy8WO1UFfvG9jVXwptft6TvB0hutUjOk1vKPNJZCKlpfgysk+zLCtwGcvmDT0+8teT8Bm68BsL5UMmX0JliR5pmi8G1FhyChex6K1SsF0HdK1Rb7IrVJDaFVRVxWjd9qqnS1DApkAmraxuVdg=; X-YMail-OSG: yj9kJ9gVM1l9Sy7L5LaeVS.PC7SLs8eP5AHTtcOIiqljfdx LQNyn_uMTUKWH147t0.BKOP5zyb_Ik6NE_S.CH2dAXWiToc7yvMTFvqTXgwE _dGB38Hp621XWKQ2w.Xf534U9TxtveOd3Xmoj1eOT4hOFv.8rDyR78EDMIue tnvuIJOobwdlLARwhPSp3fyye7Uc3yzJuSDfbhalCCIHD2nG0cA7kqgp6lUG 8trOrLoey4xhHBBdTxNk6lwen_5pNEKETzTl3D8xwLFyTPG2kuPgeazadkf. GM_BW7JIJ3egCquxGMA6Q0XN18aYKNVJndqgwOBvIf_RX42zJmcCUWEh18P4 hppLjhmyUVY5JVjbQjmyCtsOIRFyZBLZGnbmCasHN7Tgkc.Oe2uF90QlpQl. rPvNuE9bBEIXT76HhmQTTxc77oHVHAnkDiQiKTvheqM.0TNEGKaOyTU8paoL sl9.U_Ht09fN_zxK9.A2DSjp88Me6YRvkGzt1FfdoG0lYvqwN Received: from [112.134.96.104] by web160105.mail.bf1.yahoo.com via HTTP; Wed, 02 May 2012 11:59:57 PDT X-Mailer: YahooMailWebService/0.8.118.349524 References: <1335932118.29543.YahooMailNeo@web160102.mail.bf1.yahoo.com> <201205020638.q426cXhg008660@mail.r-bonomi.com> Message-ID: <1335985197.76056.YahooMailNeo@web160105.mail.bf1.yahoo.com> Date: Wed, 2 May 2012 11:59:57 -0700 (PDT) From: Unga To: Robert Bonomi , "freebsd-questions@freebsd.org" In-Reply-To: <201205020638.q426cXhg008660@mail.r-bonomi.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Cc: "kickbsd@yandex.com" Subject: Re: Segmentation fault in FreeBSD 9.0 flockfile () X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Unga List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 May 2012 19:00:04 -0000 > From: Robert Bonomi =0A> To: freebsd-questions@= freebsd.org=0A> Cc: =0A> Sent: Wednesday, May 2, 2012 6:38 AM=0A> Subject: = Re: Segmentation fault in FreeBSD 9.0 flockfile ()=0A> =0A> =0A> Unga wrote;=0A>> From: Darren Baginski =0A>>= > Unga wrote:=0A>> > =0A>> >01.05.2012, 22:08, "Ung= a" :=0A>> >> Hi all=0A>> >>=0A>> >> I'm getting a=A0 = Segmentation fault in FreeBSD 9.0 as follows =0A> for myprog.c:=0A>> >>=0A= >> >> Reading symbols from /libexec/ld-elf.so.1...done.=0A>> >> Loaded sy= mbols for /libexec/ld-elf.so.1=0A>> >> #0=A0 0x28ebb062 in flockfile () fr= om /lib/libc.so.7=0A>> >> [New Thread 29c04900 (LWP 100575/SDLTimer)]=0A>>= >> [New Thread 29c04300 (LWP 100416/myprog)]=0A>> >> (gdb)=0A>> >> (gdb= ) info threads=0A>> >> * 2 Thread 29c04300 (LWP 100416/myprog)=A0 0x28ebb0= 62 in flockfile =0A> ()=0A>> >>=A0 =A0 from /lib/libc.so.7=0A>> >>=A0 1 = Thread 29c04900 (LWP 100575/SDLTimer)=A0 0x28e1527b in _umtx_op =0A> ()=0A>= > >>=A0 =A0 from /lib/libc.so.7=0A>> >> (gdb)=0A>> >>=0A>> >> I don't u= se flockfile () directly in my program.=0A>> >>=0A>> >=0A>> >Hi!=0A>> >= =0A>> >Mind to share code snippet caused the problem?=0A>> =0A>> Hi Thank= s for the reply. I have mentioned in my original post that neithe=0A>> r I= nor SDL use the flockfile () in the source.=0A>> =0A> =0A> There was a _re= ason_ the prior poster asked about seeing your code.=0A> The information yo= u provided is not adequate/sufficient for anyone to=0A> have any chance of = helping you.=A0 Informationn that -is- necessary was=0A> therefore requeste= d.=A0 =0A> =0A> What you "don't use" is irrelevant to solving the problem. = =0A> =0A> To be any help one must figure out what you _did_ do -- which =3D= indirectly=3D =0A> calls flockfile().=0A> =0A> Your code calls "something" = in 'libc'=A0 that calls flockfile().=0A> =0A> You "don't know" what that so= mething in your code is.=A0 Other eyes =0A> _might_=0A> recognize it, -if- = they saw what you were doing.=0A> =0A> Here is how to find out what does th= at calling, yourself.=0A> 1) recompile all the components of 'myprog' with = the '-g' =0A> compiler option.=0A> 2) start 'script', so that you have a co= mplete log of the debugger =0A> session.=0A> 3) load the debugger with 'myp= rog' as the program to be debugged.=0A> 4) set a breakpoinnt in the 'flockf= ile' function=0A> 5) 'run' the program=0A> 6) when it stops at flockfile() = entry. use 'where' to see a stack trace.=0A> 7) 'display' each of the argum= ents to flockfile().=0A> 9) go 'up' to the calling code.=0A> 9) repeat step= s 7 and 8 util you reach 'your' code.=0A> 10) now 'continue' the program.= =A0 If it immediately segfaults, this was =0A> the=0A> =A0 =A0 offending ca= ll.=A0 Otherwise, the program will stop aggain at another=0A> =A0 =A0 flock= file() invocation. repeat from step 7 -until- you get the segfault.=0A> =0A= > If, from that debugger session, you still don't see anything wrong, post= =0A> the log of the debugger session.=0A> =0A> There is a *remote* possibil= ity that the program will run properly under=0A> the debugger, while it cra= shes when run directly.=A0 This has been known =0A> to happen when a progra= m _uses_ a variable before initializing it.=0A> =0A> *IF* that happens, you= will have to modify 'myprog' to add diagnostic=0A> output before and after= each identified point (above) in your code that=0A> indirectly invokes flo= ckfile() to find which is failing.=A0 =0A> =0A> In _that_ event, you =3Dwil= l=3D have to post the 'relevant' source-code from=0A> 'myprog', with the fa= iling statement identified.=0A> =0AHopefully I have not offended anyone wit= h my reply :) Very sorry if I did.=0A=0AMy this FreeBSD 9.0 box is seems ve= ry messy. I have another issue that getaddrinfo(3) doesn't accept "localhos= t". =0A=0AAfter installing FreeBSD 9.0, I installed KDE, then realised that= the existing Intel display driver does not support my Intel Sandy Bridge b= ased GPU. So I had to patch the kernel to support KMS based latest Intel dr= iver, upgraded to Xorg to 7.5.2, etc. etc. Whole process was done multiple = times as I was new to this complex upgrade.=0A=0AI presume, I should erase = off the hard disk and reinstall everything cleanly and then retry my progra= ms 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.=0A=0AAs this is ti= me consuming and as per existing commitments, I only try this at least in a= nother two weeks time. I will sure let the list know the outcome.=0A=0ABest= regards=0AUnga