From nobody Sun Feb 8 16:30:51 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+83055+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+83055+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1635802672; cv=none; d=zohomail.com; s=zohoarc; b=Nv4o6fZ527Vx6zn9JOzoFgTQX5q0ZP88hSg2uiQ0PJbVBfWCh2sAPjKmsPhlcedib0q82gmKmST8u2/ZwMsALbL+YzAph8TltmHZTSMF7Hui1o4gFyxhErYGxC1Y4lvFdiRbS34xlO96ko1WH3RTgbHcFMGYDEpRdXakDY6BUB8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1635802672; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=BYTEHStNsFEewYxwrbSucD81ZbFGEcaGTHDO8Toz0qk=; b=IDoKtGHYRcileQZO1Z9PLCPGN2w6vaakSZkubxwrvgr4/tJxcAkr59gOmm3A4UyOtDIuId8/InK4aV9tSOUhI9fDSgbaX8Yuycl09uVGM7Or5/9SEjxl5HKS1uqtLSLwMVqgSFE3TF3qVM08jWvEYgs9yLMFEwgxoLMxogIj6+I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+83055+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1635802672129708.6525760689949; Mon, 1 Nov 2021 14:37:52 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id AJviYY1788612x6B1lq71Tg1; Mon, 01 Nov 2021 14:37:51 -0700 X-Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web12.951.1635802671189382275 for ; Mon, 01 Nov 2021 14:37:51 -0700 X-IronPort-AV: E=McAfee;i="6200,9189,10155"; a="291964411" X-IronPort-AV: E=Sophos;i="5.87,200,1631602800"; d="scan'208";a="291964411" X-Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Nov 2021 14:37:49 -0700 X-IronPort-AV: E=Sophos;i="5.87,200,1631602800"; d="scan'208";a="449113013" X-Received: from mdkinney-mobl2.amr.corp.intel.com ([10.209.76.205]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Nov 2021 14:37:49 -0700 From: "Michael D Kinney" To: devel@edk2.groups.io Cc: Liming Gao , Zhiguang Liu , Michael Kubacki Subject: [edk2-devel] [Patch V2 1/7] MdePkg/Include: Enhance DebugLib to support reproduce builds Date: Mon, 1 Nov 2021 14:37:31 -0700 Message-Id: <20211101213737.586-2-michael.d.kinney@intel.com> In-Reply-To: <20211101213737.586-1-michael.d.kinney@intel.com> References: <20211101213737.586-1-michael.d.kinney@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,michael.d.kinney@intel.com X-Gm-Message-State: IrfLTzNIKZ7sIpULRLOJaMkHx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1635802671; bh=AwN0v6Pj4cw+rK9SukOmcsBMjxxn4kSaEZoVNZszF2s=; h=Cc:Date:From:Reply-To:Subject:To; b=lL6UUleUHl78hwuOol5Ixn0gaevkut7G16InOJWsjXMIILTcpCjB1R/INKxJHjsURKC vL01N9Wk1ubeY9EZN5SLZSgaGHw0YG3ZXnf71VUjrxZENO5PeIHeQy/ob61dmEXddUOwS e3H9z0lQkJClHqcg7evPwJ+DBG7B9tkHeYA= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1635802673949100002 Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3688 * Add DEBUG_LINE_NUMBER define to DebugLib.h that is by default mapped to __LINE__. A build can define DEBUG_LINE_NUMBER to use a fixed value. * Add DEBUG_EXPRESSION_STRING(Expression) macros to DebugLib.h that is by default mapped to #Expression. A build can define DEBUG_EXPRESSION_STRING_VALUE to set all expression strings to a fixed string value. Cc: Liming Gao Cc: Zhiguang Liu Cc: Michael Kubacki Signed-off-by: Michael D Kinney --- MdePkg/Include/Library/DebugLib.h | 43 ++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/MdePkg/Include/Library/DebugLib.h b/MdePkg/Include/Library/Deb= ugLib.h index 4cacd4b8e243..7fb75f956c6e 100644 --- a/MdePkg/Include/Library/DebugLib.h +++ b/MdePkg/Include/Library/DebugLib.h @@ -71,6 +71,41 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #define EFI_D_VERBOSE DEBUG_VERBOSE #define EFI_D_ERROR DEBUG_ERROR =20 +// +// Source file line number. +// Default is use the to compiler provided __LINE__ macro value. The __LIN= E__ +// mapping can be overriden by predefining DEBUG_LINE_NUMBER +// +// Defining DEBUG_LINE_NUMBER to a fixed value is useful when comparing bu= ilds +// across source code formatting changes that may add/remove lines in a so= urce +// file. +// +#ifdef DEBUG_LINE_NUMBER +#else +#define DEBUG_LINE_NUMBER __LINE__ +#endif + +/** + Macro that converts a Boolean expression to a Null-terminated ASCII stri= ng. + + The default is to use the C pre-processor stringizing operator '#' to add + quotes around the C expression. If DEBUG_EXPRESSION_STRING_VALUE is defi= ned + then the C expression is converted to the fixed string value. + + Defining DEBUG_EXPRESSION_STRING_VALUE to a fixed value is useful when + comparing builds across source code formatting changes that may make + changes to spaces or parenthesis in a Boolean expression. + + @param Expression Boolean expression. + +**/ + +#ifdef DEBUG_EXPRESSION_STRING_VALUE +#define DEBUG_EXPRESSION_STRING(Expression) DEBUG_EXPRESSION_STRING_VALUE +#else +#define DEBUG_EXPRESSION_STRING(Expression) #Expression +#endif + /** Prints a debug message to the debug output device if the specified error= level is enabled. =20 @@ -310,15 +345,15 @@ UnitTestDebugAssert ( ); =20 #if defined(__clang__) && defined(__FILE_NAME__) -#define _ASSERT(Expression) UnitTestDebugAssert (__FILE_NAME__, __LINE__,= #Expression) +#define _ASSERT(Expression) UnitTestDebugAssert (__FILE_NAME__, DEBUG_LIN= E_NUMBER, DEBUG_EXPRESSION_STRING (Expression)) #else -#define _ASSERT(Expression) UnitTestDebugAssert (__FILE__, __LINE__, #Exp= ression) +#define _ASSERT(Expression) UnitTestDebugAssert (__FILE__, DEBUG_LINE_NUM= BER, DEBUG_EXPRESSION_STRING (Expression)) #endif #else #if defined(__clang__) && defined(__FILE_NAME__) -#define _ASSERT(Expression) DebugAssert (__FILE_NAME__, __LINE__, #Expres= sion) +#define _ASSERT(Expression) DebugAssert (__FILE_NAME__, DEBUG_LINE_NUMBER= , DEBUG_EXPRESSION_STRING (Expression)) #else -#define _ASSERT(Expression) DebugAssert (__FILE__, __LINE__, #Expression) +#define _ASSERT(Expression) DebugAssert (__FILE__, DEBUG_LINE_NUMBER, DEB= UG_EXPRESSION_STRING (Expression)) #endif #endif =20 --=20 2.32.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#83055): https://edk2.groups.io/g/devel/message/83055 Mute This Topic: https://groups.io/mt/86752902/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-