From: "Guomin Jiang" <guomin.jiang@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
"Liu, Zhiguang" <zhiguang.liu@intel.com>,
"Gao, Liming" <gaoliming@byosoft.com.cn>
Cc: "Kinney, Michael D" <michael.d.kinney@intel.com>
Subject: Re: [edk2-devel] [PATCH 2/2] MdePkg/Include: Define new DEBUG_FILE to specify path.
Date: Thu, 24 Feb 2022 02:33:27 +0000 [thread overview]
Message-ID: <BN0PR11MB5696B83D3FE84463EC3896D69D3D9@BN0PR11MB5696.namprd11.prod.outlook.com> (raw)
In-Reply-To: <16D4C08DC1603ADF.6551@groups.io>
Hi Kinney, Liming, Zhiguang,
Can you give comments on this patch
Thanks
Guomin
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Guomin
> Jiang
> Sent: Friday, February 18, 2022 10:30 AM
> To: devel@edk2.groups.io
> Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Gao, Liming
> <gaoliming@byosoft.com.cn>; Liu, Zhiguang <zhiguang.liu@intel.com>
> Subject: [edk2-devel] [PATCH 2/2] MdePkg/Include: Define new
> DEBUG_FILE to specify path.
>
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3840
>
> Use DEBUG_FILE to control ASSERT path
>
> Motivation and Goal:
> 1. The path will occupy many size in DEBUG build when file path is long 2. We
> hope can reduce the size but not impact the debug capability 3. If only use
> filename, we can search the filename to locate file. It
> can save many size meanwhile.
>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Zhiguang Liu <zhiguang.liu@intel.com>
> Signed-off-by: Guomin Jiang <guomin.jiang@intel.com>
> ---
> MdePkg/Include/Library/DebugLib.h | 39 ++++++++++++++++++++++-------
> --
> 1 file changed, 28 insertions(+), 11 deletions(-)
>
> diff --git a/MdePkg/Include/Library/DebugLib.h
> b/MdePkg/Include/Library/DebugLib.h
> index 8d3d08638d73..5469c6308422 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.
>
> -Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.<BR>
> +Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
> SPDX-License-Identifier: BSD-2-Clause-Patent
>
> **/
> @@ -85,6 +85,31 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #define
> DEBUG_LINE_NUMBER __LINE__ #endif
>
> +//
> +// Source file.
> +// Default is use the to compiler provided __FILE__ macro value. The
> +__FILE__ // mapping can be overriden by predefining DEBUG_FILE // //
> +Defining DEBUG_FILE to a fixed value is useful when comparing builds //
> +across machine or configuration with different slash or path // file.
> +//
> +// Another benefit is we can customize the ASSERT path without
> +depending on // compiler ability // // It's for all no matter VS, GCC,
> +CLANG // #ifdef DEBUG_FILE #else #define DEBUG_FILE __FILE__ #endif
> +
> +// Blow override for keep clang behavior #if defined (__clang__) &&
> +defined (__FILE_NAME__) #undef DEBUG_FILE #define DEBUG_FILE
> +__FILE_NAME__ #endif
> +
> /**
> Macro that converts a Boolean expression to a Null-terminated ASCII string.
>
> @@ -337,17 +362,9 @@ UnitTestDebugAssert (
> IN CONST CHAR8 *Description
> );
>
> - #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,
> +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,
> +DEBUG_LINE_NUMBER, DEBUG_EXPRESSION_STRING (Expression))
> #endif
>
> /**
> --
> 2.35.1.windows.2
>
>
>
>
>
prev parent reply other threads:[~2022-02-24 2:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-18 2:30 [PATCH 0/2] Reduce the ASSERT patch to save the binary size Guomin Jiang
2022-02-18 2:30 ` [PATCH 1/2] BaseTools/Conf: " Guomin Jiang
2022-02-28 9:52 ` Bob Feng
2022-03-01 0:47 ` Guomin Jiang
2022-02-18 2:30 ` [PATCH 2/2] MdePkg/Include: Define new DEBUG_FILE to specify path Guomin Jiang
2022-02-18 3:33 ` [edk2-devel] [PATCH 0/2] Reduce the ASSERT patch to save the binary size Michael D Kinney
2022-02-21 1:30 ` Guomin Jiang
2022-03-01 1:47 ` 回复: " gaoliming
[not found] ` <16D4C08DC1603ADF.6551@groups.io>
2022-02-24 2:33 ` Guomin Jiang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BN0PR11MB5696B83D3FE84463EC3896D69D3D9@BN0PR11MB5696.namprd11.prod.outlook.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox