From owner-freebsd-hackers@freebsd.org Fri Aug 12 20:40:09 2016 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D43B1BB7D9D for ; Fri, 12 Aug 2016 20:40:09 +0000 (UTC) (envelope-from sbahra@backtrace.io) Received: from mail-io0-x229.google.com (mail-io0-x229.google.com [IPv6:2607:f8b0:4001:c06::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A7BC1158C for ; Fri, 12 Aug 2016 20:40:09 +0000 (UTC) (envelope-from sbahra@backtrace.io) Received: by mail-io0-x229.google.com with SMTP id 38so35225804iol.0 for ; Fri, 12 Aug 2016 13:40:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=backtrace.io; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ceeJe4uCEUjiBSfdz8XIEzstBxu5Vl4S9XK7q/zhcnw=; b=b2kCTBdkQ/MnAcUYuOwk76jL2Cr3VDhFRE02sIv345DgLsU3WaSf7fSlsVyVI3s6EF IEeMKqnxDJB3DuMrrAWQVJjApJD7pyIm/KltLfs3HkgmzlinQ12PvsXWfELCgTFxlNTg sSXjWWivgxsgLB1d6Pz2IRyG0zrs4ORKvSm5c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ceeJe4uCEUjiBSfdz8XIEzstBxu5Vl4S9XK7q/zhcnw=; b=MpAj3GtH7MEFmO1y/cAwQGTBeIWXA8vRqKqW1zh5f7+9i6wm4cI2oqDej/XbzFC2nr /pctAcYQumI0MD70CrvFf7e1nGW/gih5X0vIoKASCpQo9Vjca6giAevz4uaRmKCnOrbL Uq01XVifPdHnHkp9kC/jZgU9aWT/ikh407EQ3iM2asTCGECYmY0tYqiVG0QBioE4FCLw NmXCOnwVXL/+pLeqt/ipI137qzhC2G+u3AM4fGIMNZAgI6cxGDGkTEBTLqt9614iJCar s2zXG7s1z+2JRfpGvba4Lj3tg+zGd+WTjVLJ8hmT+35704q1iiVz9eykfKBmEXoQswLx masg== X-Gm-Message-State: AEkoouuj9NOkeu42j632yveb207fYwHLgnV/c6sbU0qahm1ABdvUdFfYh2QUXS3n+6U7cvlAwsNaaFLau2/DTqMI X-Received: by 10.107.140.17 with SMTP id o17mr19659225iod.69.1471034408636; Fri, 12 Aug 2016 13:40:08 -0700 (PDT) MIME-Version: 1.0 References: <5cc825d5-9ed7-efac-b711-60a8d4b18cc4@FreeBSD.org> <1551519.RkbAThDAeZ@ralph.baldwin.cx> In-Reply-To: <1551519.RkbAThDAeZ@ralph.baldwin.cx> From: Samy Bahra Date: Fri, 12 Aug 2016 20:39:57 +0000 Message-ID: Subject: Re: How to get better debugging for the kernel. To: John Baldwin , freebsd-hackers@freebsd.org Cc: "K. Macy" , Andriy Gapon , Ryan Stone X-Mailman-Approved-At: Fri, 12 Aug 2016 20:48:41 +0000 Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.22 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Aug 2016 20:40:09 -0000 Slides up at: http://backtrace.io/blog/images/bbcon2016-sbahra.pdf On Fri, Aug 12, 2016 at 4:32 PM John Baldwin wrote: > On Thursday, August 04, 2016 01:07:39 AM K. Macy wrote: > > On Wed, Aug 3, 2016 at 12:53 PM, Andriy Gapon wrote: > > > On 03/08/2016 20:14, Ryan Stone wrote: > > >> Are you using the kgdb from the base system or from ports(it's a part > of > > >> devel/gdb)? The kgdb in ports is significantly better. If you > haven't > > >> tried the version from ports already, definitely do that first. > > > > > > kgdb 7.x from ports is certainly more powerful than the old base kgdb, > > > but clang with O2 optimizations seems to be too much even for it. > > > > Samy did a good presentation about this issue. I'm hoping I can get > > him to put his slides on line. Evidently clang is much more simplistic > > about how it treats callee saved registers. In essence clang will > > always err on the side of saying "optimized out" even when it has > > sufficient state to know otherwise. Gcc, on the other hand will > > sometimes incorrectly infer that a value is valid when it is in fact > > not. > > > > I have been building some kernels with clang with dwarf4 enabled (and > > thus needed to use kgdb 7.x from ports). Contrary to what I have heard > > from some others I have found it to have virtually no added benefit. > > My understanding is that dwarf4 will not help with C programs like the > kernel, that the new idioms in dwarf4 are for declaring more complex > constructs in C++11, C++14, etc. I have heard that clang does not update > debug information during optimization passes causing it to loose track of > variables that are moved during optimization. I have not (yet) tried > using gcc as avg@ describes though I will likely start doing so soon. > > -- > John Baldwin >