From owner-freebsd-hackers@FreeBSD.ORG Wed Feb 24 19:00:47 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3960F1065670 for ; Wed, 24 Feb 2010 19:00:47 +0000 (UTC) (envelope-from shuvaev@physik.uni-wuerzburg.de) Received: from mailrelay.rz.uni-wuerzburg.de (mailrelay.rz.uni-wuerzburg.de [132.187.3.28]) by mx1.freebsd.org (Postfix) with ESMTP id B6F908FC17 for ; Wed, 24 Feb 2010 19:00:46 +0000 (UTC) Received: from virusscan.mail (localhost [127.0.0.1]) by mailrelay.mail (Postfix) with ESMTP id 56B135AC5F; Wed, 24 Feb 2010 20:00:37 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by virusscan.mail (Postfix) with ESMTP id 533D85AC4D; Wed, 24 Feb 2010 20:00:37 +0100 (CET) X-Virus-Scanned: by amavisd-new at uni-wuerzburg.de Received: from mail.physik.uni-wuerzburg.de (wthp192.physik.uni-wuerzburg.de [132.187.40.192]) by mailmaster.uni-wuerzburg.de (Postfix) with ESMTP id 315E25D7B1; Wed, 24 Feb 2010 20:00:37 +0100 (CET) Received: from wep4035 ([132.187.37.35]) by mail.physik.uni-wuerzburg.de (Lotus Domino Release 8.5.1FP1) with ESMTP id 2010022420003564-53182 ; Wed, 24 Feb 2010 20:00:35 +0100 Received: by wep4035 (sSMTP sendmail emulation); Wed, 24 Feb 2010 20:00:35 +0100 Date: Wed, 24 Feb 2010 20:00:35 +0100 From: Alexey Shuvaev To: Peter Steele Message-ID: <20100224190035.GA5026@wep4035.physik.uni-wuerzburg.de> References: <7B9397B189EB6E46A5EE7B4C8A4BB7CB385D5C73@MBX03.exg5.exghost.com> <20100220113349.GA22800@kiwi.sharlinx.com> <7B9397B189EB6E46A5EE7B4C8A4BB7CB385D60B7@MBX03.exg5.exghost.com> <7B9397B189EB6E46A5EE7B4C8A4BB7CB385D60DD@MBX03.exg5.exghost.com> <7B9397B189EB6E46A5EE7B4C8A4BB7CB39E95389@MBX03.exg5.exghost.com> MIME-Version: 1.0 In-Reply-To: <7B9397B189EB6E46A5EE7B4C8A4BB7CB39E95389@MBX03.exg5.exghost.com> Organization: Universitaet Wuerzburg User-Agent: Mutt/1.5.20 (2009-06-14) X-MIMETrack: Itemize by SMTP Server on domino1/uni-wuerzburg(Release 8.5.1FP1|January 05, 2010) at 02/24/2010 08:00:36 PM, Serialize by Router on domino1/uni-wuerzburg(Release 8.5.1FP1|January 05, 2010) at 02/24/2010 08:00:36 PM, Serialize complete at 02/24/2010 08:00:36 PM Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Cc: "freebsd-hackers@freebsd.org" Subject: Re: ntpd hangs under FBSD 8 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Feb 2010 19:00:47 -0000 On Wed, Feb 24, 2010 at 12:17:50PM -0600, Peter Steele wrote: > >You're going to need a debug version of libc, too. > >gdb won't be able to find a backtrace out of a libc function without it. > > What's the proper way to build a debug version of libc and the other > libraries? I tried this: > > export CFLAGS="-O0" > make buildworld > make installworld DESTDIR=/mydir > > and then copied libc.so.7 from /mydir/lib to the /lib dir on > my target system. I also replaced the ntpd binary with the debug version. > I can see that -O0 is being used in the various "cc" commands that are > generated, but libc still doesn't seem to be built properly. > When I attach to a hung ntpd process, I get this: > > # gdb /usr/sbin/ntpd -p 2113 > GNU gdb 6.1.1 [FreeBSD] > ... > Attaching to program: /usr/sbin/ntpd, process 2113 > Reading symbols from /lib/libm.so.5...(no debugging symbols found)...done. > ... > Reading symbols from /lib/libc.so.7...(no debugging symbols found)...done. > Loaded symbols for /lib/libc.so.7 > Reading symbols from /lib/libthr.so.3...(no debugging symbols found)...done. > ... > [Switching to Thread 8012041c0 (LWP 100283)] > 0x0000000800dbeddc in select () from /lib/libc.so.7 > (gdb) bt > #0 0x0000000800dbeddc in select () from /lib/libc.so.7 > #1 0x00000000004335de in ntpdmain () > #2 0x000000000043310b in main () > > So I'm getting some symbols from ntpd but I still can't see into select(). > I think not. > It hangs in there forever so that's where I need to drill down further. > How do I get libc built with full debug symbols? > I haven't tried it by myself but think here is the way to go: put the following to /etc/make.conf and recompile needed libraries / ports. WITH_DEBUG=yes DEBUG_FLAGS=-g This should do the trick for both base and ports. > > [snip] > > If anyone has any clues at all as to what is causing this issue, > I'd appreciate the feedback. Here's the code that reproduces this behavior. > > #! /usr/bin/env python > import os > import threading > > class RunProc(threading.Thread): > def __init__(self, cmd): > threading.Thread.__init__(self) > self.cmd = cmd > > def run(self): > os.system(self.cmd) > > def main(): > RunProc("/usr/sbin/ntpd -g -q").start() > > if __name__ == "__main__": > main() > Mmm... Do other daemons (sshd, lpd, ...) also fail when started through this script? Normal commands (ls, ps) seem not affected. 0.02$, Alexey.