From owner-freebsd-hackers@FreeBSD.ORG Tue Sep 4 21:50:39 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5B6E2106564A; Tue, 4 Sep 2012 21:50:39 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id 14FC78FC08; Tue, 4 Sep 2012 21:50:39 +0000 (UTC) Received: from [192.168.0.6] (spaceball.home.andric.com [192.168.0.6]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 4A2475C44; Tue, 4 Sep 2012 23:50:37 +0200 (CEST) Message-ID: <504677AB.8040908@FreeBSD.org> Date: Tue, 04 Sep 2012 23:50:35 +0200 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20120828 Thunderbird/16.0 MIME-Version: 1.0 To: Eitan Adler References: <53c5133d8fac4f4353eda0add82e2234@viper-webmail.viper.enta.net> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: Jake Smith , freebsd-ports@freebsd.org, freebsd-hackers@freebsd.org Subject: Re: Building with WITH_DEBUG (-g) in make.conf 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: Tue, 04 Sep 2012 21:50:39 -0000 On 2012-09-04 17:53, Eitan Adler wrote: > On 4 September 2012 05:26, Jake Smith wrote: ... >> It got me thinking, is there any reason why it would be a bad idea to build >> all my ports with debug symbols from now on? > >> Are there any performance hits > > Yes. Code size grows and the flags may enable internal > debugging in the program itself. There's a difference between just using '-g', which should never change the behaviour of the program at runtime, and adding -DDEBUG or similar flags on the command line, which may or may not enable extra code, or even cause totally different code paths. What is not different, is that both -g and other debugging options will generally cause compiling and linking to take longer, since these stages will have to process the additional debug information. >> or security risks with this? > > no. You cannot know in general. If debug options enable a different code path, you might as well get a security problem with it for free. :) I have seen many debug printf's which could easily be exploited for buffer overruns, etc. However, only using '-g' should make no difference, indeed.