From nobody Thu Dec 07 02:17:14 2023 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Slyb32ZpXz53PK7 for ; Thu, 7 Dec 2023 02:17:19 +0000 (UTC) (envelope-from zlei@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Slyb31wHPz4Ztn; Thu, 7 Dec 2023 02:17:19 +0000 (UTC) (envelope-from zlei@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1701915439; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Adq0TleVVD6HWeFHSvDAqHs4g2EXRGnjVUN2DbNnrhk=; b=QEtUltxYa4TLntiKnBWj7WzjcKZGcLPW6XFwBaVGwq4isf+/yfnIPfGSRF0cr4o+5xVWD2 zoZQUnhT8zM4aNn7gpelQxtTLwFsUoCFppC1j0wI/8wGCcYdtJWFQL3PnB3We5unRamsNj aKogfKGodEoDLEnKz/SOh0soZ/zNyTogJ25cgkfjqdanBAccgpK4RsQUexUgwbyn9FIrwJ Ls2uP90GSwuC/VL0hGi/tHEPQn11yNhyaJ5D5Cr7N2M489T2fjMRFKykjikRMX9WAB3hFe OTueYztPDuuRAwKkfTaHElXQNhafs8rpvikHSiIVGLiUTOH0jhbNEHtZyhOtBA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1701915439; a=rsa-sha256; cv=none; b=ilwWp660c2wgF+H/qmDDBUHUWU3mSOBxSTiLl6C/9sF6BiX+SXmL7LufnV85PjxqGnPZxi oZ/97vMDLDzPDsCNPdsk/TUB+A8l6qxi25MpS+gnVrpwWPIRE02Tssbu8dB81DXDUC7Sq/ N7Pl6U+6IN2dwB7xb7R1I70utzDJfPFwB/bh5GZEDR3Ho1QSGvpCaJh0NwkREmS/rl0kuv tbDUEQv6tJTD08sowvbaaTtRb0t+eKYkb1gap119K4dC4WtovuUWsI8H3uDBRIai40xrQP HoFjyossUbK3KsaB6hMh92M6Cs8iB1T5j8X5v7Cim+6wOPB3AE3oHRvfejsOsw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1701915439; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Adq0TleVVD6HWeFHSvDAqHs4g2EXRGnjVUN2DbNnrhk=; b=Qg1G94pajBugsnCvOMQt74jKdis6Dk19YIcXV8SukWGFT+oRBL8wSKOtSFaWpC61anYW8Y KQ2nfXSmOjFXSpu4a3Yq5dJBVq+XX7puAeimEOdEi84ukl4fqERWY7zFPt9lM/XPvhZQ6g pI+IjlNofkpEYCdkCFaPCi5rzk0QEGgzjyQQF7dnIkb6hx6zT8F2M/1UnvW6ixtHNSjbFY ZxrS9cRo1V+PPkQY27qQOHyflqgo2s1lC2lc27ZJ1+y20a2Ntx6AauSLEC2hEKZAMti9ue al8NU52X34MITnTMbqjz6nknXgoJk9EyyoUbWb/CZcsF6QFSysEwK9E+ArrECw== Received: from smtpclient.apple (unknown [112.66.190.139]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: zlei/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4Slyb22gh2z1MX5; Thu, 7 Dec 2023 02:17:18 +0000 (UTC) (envelope-from zlei@FreeBSD.org) Content-Type: text/plain; charset=us-ascii List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.4\)) Subject: Re: Build src tree in Develop/Debug mode From: Zhenlei Huang In-Reply-To: <1fc31593-a274-4dc7-a4a5-ec2af0cb392a@app.fastmail.com> Date: Thu, 7 Dec 2023 10:17:14 +0800 Cc: freebsd-hackers@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <847F2A9D-AE5F-4BFC-85CD-51900A9218EA@FreeBSD.org> References: <1fc31593-a274-4dc7-a4a5-ec2af0cb392a@app.fastmail.com> To: Farhan Khan X-Mailer: Apple Mail (2.3696.120.41.1.4) > On Dec 7, 2023, at 1:09 AM, Farhan Khan wrote: >=20 > Hi all, >=20 > Is there a build-in-debug-mode flag I can run when building the kernel = (or world)? >=20 > I was tinkering through the build system and saw that the optimization = is hardcoded to -O2 and objcopy strips debugging symbols. This means = even with "CFLAGS+=3D-g -O0 -fno-inline-functions" in my /etc/make.conf = I am still losing symbols and sometimes getting unwanted optimizations. = The result is that `kgdb` often does not know what line a crash took = place in. >=20 > Is there an option to disable all optimizations, optimizations and = symbol stripping? If not, IMO, this would be a good candidate for an = option to add. There's an option COPTFLAGS. You can try=20 ``` $ setenv COPTFLAGS -O0 $ make buildkernel KERNCONF=3DGENERIC ``` >=20 > I briefly wrote about this a few years back: = https://blog.farhan.codes/2018/08/16/including-optimized-out-kernel-symbol= s-in-dtrace-on-freebsd/ >=20 > Thanks! > -- > Farhan Khan > PGP Fingerprint: 1312 89CE 663E 1EB2 179C 1C83 C41D 2281 F8DA C0DE >=20 >=20 Best regards, Zhenlei