From owner-freebsd-hackers@freebsd.org Thu Aug 4 08:07:40 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 ADD91BAEF95 for ; Thu, 4 Aug 2016 08:07:40 +0000 (UTC) (envelope-from kmacybsd@gmail.com) Received: from mail-io0-x22f.google.com (mail-io0-x22f.google.com [IPv6:2607:f8b0:4001:c06::22f]) (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 778B91A7F; Thu, 4 Aug 2016 08:07:40 +0000 (UTC) (envelope-from kmacybsd@gmail.com) Received: by mail-io0-x22f.google.com with SMTP id 38so265239771iol.0; Thu, 04 Aug 2016 01:07:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=8xdqwa/KT5woZaotWdEd47ySmZhYD3EYZtR7awD/e3I=; b=NjxtvvlnH0xV5ARM3Atnvhge3BJhmonzA8y1Wx/wgCKVrHXNcuM5kYlrse9DAmIdeq DB3DVaQE6V64TRfTf7LbGv5EvJZj7aV7L6tZ1Kaf2LRrz8bNKbVFa2YRij6etcExyVDK Zy4eGTi6Bd4uRZN33HbYdKsJgXlCS1fZ7w4fEis6ML9DNFccaQObkhGQm5xyCoS9wsYe U/UNNaKasb/jvn5m/WVxC7VzxNIlD8UPjL+kpbps0T3mow841LbzSsoXwi/OJ3naTVf4 jYIkZniw4TqpdxJqsMA75D35/Wx+My8XPqHQ73JvCASGPmgiyRxMY7xrXpgZXi4I1ldD /tUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=8xdqwa/KT5woZaotWdEd47ySmZhYD3EYZtR7awD/e3I=; b=SpLvFZj3iJIa7guIrZ+oR98tBufY99gCiBsZbO29AGdrRPzu2fH7FdGVXSjtxSZ/gn RK7JyShVei+q2NhnLPrFkwAYhXic1BwfCAA8Ea/GFWF97SUdxpNVJb4Mmci2RzCoOiWi rNTxnyzt2fCJtkfjHlujfVl3bMhnZHFhKYmxstRFBJDVyHDtxSZAzIzYc71QC8hskGhd rVV0k2zTF2Aj3W5UzrzyLME6+yqpPP0Vyf0s3jiQ7IJe2ZpGyRkENvHxHGPcaLzy2zwZ 1P5R+Sv0R76Ibbb4vfmxPh6zXSo1xbbggHnA1bEKS3w6H4DGisq/sWeeVPR9FBKE8hPT 35iA== X-Gm-Message-State: AEkoousVkTSwShrwFSfX+i0w1cvnoh7GHWEtsS/QmwAS7azfZ2LzokRMEuBkgHrPn5yUI3gwU9KOnDyFpfqU1A== X-Received: by 10.107.29.67 with SMTP id d64mr69582232iod.138.1470298059784; Thu, 04 Aug 2016 01:07:39 -0700 (PDT) MIME-Version: 1.0 Sender: kmacybsd@gmail.com Received: by 10.107.143.11 with HTTP; Thu, 4 Aug 2016 01:07:39 -0700 (PDT) In-Reply-To: <5cc825d5-9ed7-efac-b711-60a8d4b18cc4@FreeBSD.org> References: <5cc825d5-9ed7-efac-b711-60a8d4b18cc4@FreeBSD.org> From: "K. Macy" Date: Thu, 4 Aug 2016 01:07:39 -0700 X-Google-Sender-Auth: bk-qVY1PBY7OXOyXnMRHQq9QJqU Message-ID: Subject: Re: How to get better debugging for the kernel. To: Andriy Gapon Cc: Ryan Stone , FreeBSD Hackers , Samy Bahra Content-Type: text/plain; charset=UTF-8 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: Thu, 04 Aug 2016 08:07:40 -0000 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. There is evidently some mechanism for appending an epilogue to functions. This would allow us to conditionally force clang to treat all function argument as being live to the end of the function. -M