From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by mx.groups.io with SMTP id smtpd.web09.849.1649812281626357516 for ; Tue, 12 Apr 2022 18:11:22 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=none, err=permanent DNS error (domain: byosoft.com.cn, ip: 58.240.74.242, mailfrom: gaoliming@byosoft.com.cn) Received: from DESKTOPS6D0PVI ([101.224.116.119]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Wed, 13 Apr 2022 09:02:54 +0800 X-WM-Sender: gaoliming@byosoft.com.cn X-Originating-IP: 101.224.116.119 X-WM-AuthFlag: YES X-WM-AuthUser: gaoliming@byosoft.com.cn From: "gaoliming" To: "'Guomin Jiang'" , Cc: "'Michael D Kinney'" , "'Zhiguang Liu'" References: <20220412102434.923-1-guomin.jiang@intel.com> In-Reply-To: <20220412102434.923-1-guomin.jiang@intel.com> Subject: =?UTF-8?B?5Zue5aSNOiBbUEFUQ0ggdjIgMS8xXSBNZGVQa2cvSW5jbHVkZTogVXNlIERFQlVHX0ZJTEVfUEFUSCB0byBzcGVjaWZ5IGRlYnVnIGZpbGUgcGF0aC4=?= Date: Wed, 13 Apr 2022 09:02:56 +0800 Message-ID: <000f01d84ed2$362c20f0$a28462d0$@byosoft.com.cn> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQG++iC50KcZh+n3c4wUxydpJ1aeEa0fr+rw Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn Guomin: Can you introduce DEBUG_FILE_PATH usage? If the developer wants to = enable this feature, how configure DEBUG_FILE_PATH? Thanks Liming > -----=D3=CA=BC=FE=D4=AD=BC=FE----- > =B7=A2=BC=FE=C8=CB: Guomin Jiang > =B7=A2=CB=CD=CA=B1=BC=E4: 2022=C4=EA4=D4=C212=C8=D5 18:25 > =CA=D5=BC=FE=C8=CB: devel@edk2.groups.io > =B3=AD=CB=CD: Michael D Kinney ; Liming = Gao > ; Zhiguang Liu > =D6=F7=CC=E2: [PATCH v2 1/1] MdePkg/Include: Use DEBUG_FILE_PATH to = specify > debug file path. >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3840 >=20 > Use DEBUG_FILE_PATH to control ASSERT path >=20 > Motivation and Goal: > 1. Make replication build more easy and less toolchain dependency > 2. Consume the ASSERT string easy for downstream > 3. Make code more clear >=20 > Cc: Michael D Kinney > Cc: Liming Gao > Cc: Zhiguang Liu > Signed-off-by: Guomin Jiang > --- > MdePkg/Include/Library/DebugLib.h | 34 = +++++++++++++++++++++---------- > 1 file changed, 23 insertions(+), 11 deletions(-) >=20 > diff --git a/MdePkg/Include/Library/DebugLib.h > b/MdePkg/Include/Library/DebugLib.h > index 8d3d08638d73..a76a268a00b6 100644 > --- a/MdePkg/Include/Library/DebugLib.h > +++ b/MdePkg/Include/Library/DebugLib.h > @@ -8,7 +8,7 @@ > of size reduction when compiler optimization is disabled. If > MDEPKG_NDEBUG is > defined, then debug and assert related macros wrapped by it are the > NULL implementations. >=20 > -Copyright (c) 2006 - 2020, Intel Corporation. All rights = reserved.
> +Copyright (c) 2006 - 2022, Intel Corporation. All rights = reserved.
> SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > **/ > @@ -85,6 +85,26 @@ SPDX-License-Identifier: BSD-2-Clause-Patent > #define DEBUG_LINE_NUMBER __LINE__ > #endif >=20 > +// > +// Source file path. > +// Default is use the __FILE__ macro value provided by compiler. The > __FILE__ > +// mapping can be overriden by predefining DEBUG_FILE_PATH > +// > +// Defining DEBUG_FILE_PATH to a fixed value is useful when comparing > builds > +// across machine or configuration with different slash or path file. > +// > +#ifndef DEBUG_FILE_PATH > +#define DEBUG_FILE_PATH __FILE__ > +#endif > + > +// > +// Use below override to keep CLANG specific behavior > +// > +#if defined (__clang__) && defined (__FILE_NAME__) > + #undef DEBUG_FILE_PATH > +#define DEBUG_FILE_PATH __FILE_NAME__ > +#endif > + > /** > Macro that converts a Boolean expression to a Null-terminated ASCII > string. >=20 > @@ -337,17 +357,9 @@ UnitTestDebugAssert ( > IN CONST CHAR8 *Description > ); >=20 > - #if defined (__clang__) && defined (__FILE_NAME__) > -#define _ASSERT(Expression) UnitTestDebugAssert (__FILE_NAME__, > DEBUG_LINE_NUMBER, DEBUG_EXPRESSION_STRING (Expression)) > - #else > -#define _ASSERT(Expression) UnitTestDebugAssert (__FILE__, > DEBUG_LINE_NUMBER, DEBUG_EXPRESSION_STRING (Expression)) > - #endif > +#define _ASSERT(Expression) UnitTestDebugAssert (DEBUG_FILE_PATH, > DEBUG_LINE_NUMBER, DEBUG_EXPRESSION_STRING (Expression)) > #else > - #if defined (__clang__) && defined (__FILE_NAME__) > -#define _ASSERT(Expression) DebugAssert (__FILE_NAME__, > DEBUG_LINE_NUMBER, DEBUG_EXPRESSION_STRING (Expression)) > - #else > -#define _ASSERT(Expression) DebugAssert (__FILE__, > DEBUG_LINE_NUMBER, DEBUG_EXPRESSION_STRING (Expression)) > - #endif > +#define _ASSERT(Expression) DebugAssert (DEBUG_FILE_PATH, > DEBUG_LINE_NUMBER, DEBUG_EXPRESSION_STRING (Expression)) > #endif >=20 > /** > -- > 2.35.1.windows.2