From owner-freebsd-current@FreeBSD.ORG Thu Feb 12 17:55:17 2015 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 371E99A; Thu, 12 Feb 2015 17:55:17 +0000 (UTC) Received: from mail-qg0-x22b.google.com (mail-qg0-x22b.google.com [IPv6:2607:f8b0:400d:c04::22b]) (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 E28C33B0; Thu, 12 Feb 2015 17:55:16 +0000 (UTC) Received: by mail-qg0-f43.google.com with SMTP id i50so9266571qgf.2; Thu, 12 Feb 2015 09:55:16 -0800 (PST) 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:content-type; bh=CPwlq52RNd96UbKrT3xRXMDoYc5dvucVbSHIGgM1NBg=; b=EDnbSbgY/z2jZD5o7mcaH+kP8ADvdTVtIdGRvGIcsgsDAWU96zrng7RpsjPJDCMzqc gP/K7JVYViPktzQeRAbN8tGUUZy6n4VGEosxYA/6i0ajGrx0UQhiKpRhGr7gWDIvHOki FnEg5q8C+ugssN/Uoe8sZzhw6sg+Nhv74lnMQF/+Vx8H2ajzt/eit2ZCF5AcSk70jVaW +yWemCBVM1WD8DhOyewuDfBGF2sBqi34MwuT4V0ISGo6/WdIIOijBiDtg8JKve49n4Ep 9cZNibMRaMpu0hV3Zx4tagIEcHm3rBaFSdRN0cGlVG6Twh05ah06D7c/I3bY77qvp1v+ eTSw== X-Received: by 10.229.80.72 with SMTP id s8mr13437857qck.24.1423763716109; Thu, 12 Feb 2015 09:55:16 -0800 (PST) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.140.39.209 with HTTP; Thu, 12 Feb 2015 09:54:55 -0800 (PST) In-Reply-To: <20150212152936.GA66037@troutmask.apl.washington.edu> References: <20150212023912.GG1302@hub.FreeBSD.org> <20150212152936.GA66037@troutmask.apl.washington.edu> From: Ed Maste Date: Thu, 12 Feb 2015 12:54:55 -0500 X-Google-Sender-Auth: bVG7fJa-QZNOCHVcIucKSlCU_LY Message-ID: Subject: Re: HEADS-UP: Enabling WITH_DEBUG_FILES by default To: Steve Kargl Content-Type: text/plain; charset=UTF-8 Cc: Glen Barber , FreeBSD Current X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Feb 2015 17:55:17 -0000 On 12 February 2015 at 10:29, Steve Kargl wrote: > > Does this feature take into account the optimization level > that one may set via CFLAGS? Conventional wisdom used to > claim that debuggers did not fair too well with code that > was compiled with -O2 (or -Os and/or other well-known gcc > options -fomit-frame-pointer, etc.) The common advice was > to recompile one's code with -g or '-g -O'. Does lldb cope > better with optimized binaries? The WITH_DEBUG_FILES option builds debug regardless of what optimization level is set. I'm not quite sure in which way WITH_DEBUG_FILES would take account of the optimization level. It's true that debugging is easier if the target is built with -O0. If I have a reproducible crash as a developer, I would rebuild with -O0. That may not be feasible for end users though, and doesn't help in the case of a crash that can't be reproduced. That said, debugging is still possible with -O2, it just loses information or makes control flow hard to follow in some (perhaps many) cases. Type and source line information is still available. It may not be possible to read the value of some variables at some times during execution, and stepping can be confusing. But it's usually possible to get a useful backtrace and find necessary variables. All of my systems are built with -O2 and WITH_DEBUG_FILES, and generally speaking I have a positive experience with postmortem debugging of core files. LLDB does handle optimized binaries better than the ancient version of GDB we have in the base system. Contemporary GDB versions also do so. Also note that for userland DTrace support we build with -g as part of the process of generating CTF information, so enabling userland DTrace also implies an increase in OBJDIR size.