From nobody Fri Dec 27 02:05:19 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1502769447115613.8219024739954; Mon, 14 Aug 2017 20:57:27 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 2A31421DFC89E; Mon, 14 Aug 2017 20:54:58 -0700 (PDT) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id C1D8D21B06E9B for ; Mon, 14 Aug 2017 20:54:56 -0700 (PDT) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP; 14 Aug 2017 20:57:20 -0700 Received: from mdkinney-mobl1.amr.corp.intel.com ([10.241.98.166]) by fmsmga006.fm.intel.com with ESMTP; 14 Aug 2017 20:57:20 -0700 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,376,1498546800"; d="scan'208";a="140268902" From: Michael D Kinney To: edk2-devel@lists.01.org Date: Mon, 14 Aug 2017 20:57:17 -0700 Message-Id: <20170815035718.1560-2-michael.d.kinney@intel.com> X-Mailer: git-send-email 2.13.1.windows.2 In-Reply-To: <20170815035718.1560-1-michael.d.kinney@intel.com> References: <20170815035718.1560-1-michael.d.kinney@intel.com> Subject: [edk2] [edk2-staging/edk2-test Patch V2 1/2] Test*Pkg: Update DSC files to improve debug X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Kinney , Andrew Fish , Felix Polyudov MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Update the DSC files to improve debug of the TestFrameworkPkg and TestCasePkg. * If -b DEBUG build, then enable DEBUG() messages on the standard error console device with messages of type DEBUG_ERROR, DEBUG_VERBOSE, DEBUG_INFO, DEBUG_WARN, and DEBUG_INIT enabled. * If -b DEBUG build, then enable ASSERT() macros and configure ASSERT() macros to generate a break point when triggered. * If -b DEBUG build, then generated mixed C/ASM output for MSFT builds to help find and fix source code that causes memcpy() and memset() instrinsics to be used. * If -b RELEASE build, then disable all DEBUG() messages and ASSERT() macros and do not generated mixed C/ASM output files. * Add NT32 define that builds the TestFrameworkPkg and TestCasePkg components so they are compatible with NT32 environment debuggers. Cc: Felix Polyudov Cc: Andrew Fish Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Michael Kinney Reviewed-by: Felix Polyudov --- TestCasePkg/TestCasePkg.dsc | 65 +++++++++++++++++++++++++++++++= ++++ TestFrameworkPkg/TestFrameworkPkg.dsc | 62 +++++++++++++++++++++++++++++++= ++ 2 files changed, 127 insertions(+) diff --git a/TestCasePkg/TestCasePkg.dsc b/TestCasePkg/TestCasePkg.dsc index c2f1832ae..e7e32d4e0 100644 --- a/TestCasePkg/TestCasePkg.dsc +++ b/TestCasePkg/TestCasePkg.dsc @@ -24,6 +24,18 @@ SKUID_IDENTIFIER =3D DEFAULT POSTBUILD =3D TestCasePkg/GenFramework.cmd =20 + # + # Platform On/Off features are defined here + # + DEFINE LOGGING =3D FALSE + DEFINE SOURCE_DEBUG_ENABLE =3D FALSE + DEFINE NT32 =3D FALSE + + !if $(TARGET) =3D=3D "DEBUG" + DEFINE LOGGING =3D TRUE + DEFINE SOURCE_DEBUG_ENABLE =3D TRUE + !endif + [LibraryClasses] UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntry= Point.inf UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiA= pplicationEntryPoint.inf @@ -39,11 +51,64 @@ BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchroniza= tionLib.inf PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf +!if $(LOGGING) DebugLib|MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibStdErr.inf +!else + DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf +!endif DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseD= ebugPrintErrorLevelLib.inf PostCodeLib|MdePkg/Library/BasePostCodeLibPort80/BasePostCodeLibPort80.i= nf PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf EfiTestLib|TestFrameworkPkg/Library/EfiTestLib/EfiTestLib.inf =20 +[PcdsFixedAtBuild] +!if $(LOGGING) + !if $(SOURCE_DEBUG_ENABLE) + # + # Enabled ASSERT(), DEBUG(), and DEBUG_CODE() and configure ASSERT() to + # generate a breakpoint. + # + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x17 + !else + # + # Enabled ASSERT(), DEBUG(), and DEBUG_CODE() and configure ASSERT() to + # generate a deadloop. + # + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x27 + !endif +!else + # + # Disable ASSERT(), DEBUG(), DEBUG_CODE(), and DEBUG_CLEAR_MEMORY() + # + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x0 +!endif + +[PcdsPatchableInModule] +!if $(LOGGING) + # + # Enable DEBUG() messages of type DEBUG_ERROR, DEBUG_VERBOSE, DEBUG_INFO, + # DEBUG_WARN, and DEBUG_INIT + # + gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80400043 +!endif + [Components] TestCasePkg/Timer/ArchTimerBBTest.inf + +[BuildOptions] +!if $(TARGET) =3D=3D "DEBUG" + # + # Generate mixed C/ASM files for debug builds + # + MSFT:*_*_*_CC_FLAGS =3D /FAsc +!endif + +!if $(NT32) + # + # If -D NT32 is set on command line to build, then build all components = to be + # compatible with NT32 environment debuggers. + # + DEBUG_*_*_DLINK_FLAGS =3D /EXPORT:InitializeDriver=3D$(IMAGE_ENTRY_POI= NT) /BASE:0x10000 /ALIGN:4096 /FILEALIGN:4096 /SUBSYSTEM:CONSOLE + NOOPT_*_*_DLINK_FLAGS =3D /EXPORT:InitializeDriver=3D$(IMAGE_ENTRY_POI= NT) /BASE:0x10000 /ALIGN:4096 /FILEALIGN:4096 /SUBSYSTEM:CONSOLE + RELEASE_*_*_DLINK_FLAGS =3D /ALIGN:4096 /FILEALIGN:4096 +!endif diff --git a/TestFrameworkPkg/TestFrameworkPkg.dsc b/TestFrameworkPkg/TestF= rameworkPkg.dsc index 93c8886af..ebf866e39 100644 --- a/TestFrameworkPkg/TestFrameworkPkg.dsc +++ b/TestFrameworkPkg/TestFrameworkPkg.dsc @@ -24,6 +24,18 @@ SKUID_IDENTIFIER =3D DEFAULT POSTBUILD =3D TestFrameworkPkg/GenFramework.cmd =20 + # + # Platform On/Off features are defined here + # + DEFINE LOGGING =3D FALSE + DEFINE SOURCE_DEBUG_ENABLE =3D FALSE + DEFINE NT32 =3D FALSE + + !if $(TARGET) =3D=3D "DEBUG" + DEFINE LOGGING =3D TRUE + DEFINE SOURCE_DEBUG_ENABLE =3D TRUE + !endif + [LibraryClasses] UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntry= Point.inf UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiA= pplicationEntryPoint.inf @@ -39,7 +51,11 @@ BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchroniza= tionLib.inf PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf +!if $(LOGGING) DebugLib|MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibStdErr.inf +!else + DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf +!endif DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseD= ebugPrintErrorLevelLib.inf PostCodeLib|MdePkg/Library/BasePostCodeLibPort80/BasePostCodeLibPort80.i= nf PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf @@ -56,6 +72,37 @@ EntsLib|TestFrameworkPkg/Library/EasLib/EntsLib.inf EfiTestLib|TestFrameworkPkg/Library/EfiTestLib/EfiTestLib.inf =20 +[PcdsFixedAtBuild] +!if $(LOGGING) + !if $(SOURCE_DEBUG_ENABLE) + # + # Enabled ASSERT(), DEBUG(), and DEBUG_CODE() and configure ASSERT() to + # generate a breakpoint. + # + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x17 + !else + # + # Enabled ASSERT(), DEBUG(), and DEBUG_CODE() and configure ASSERT() to + # generate a deadloop. + # + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x27 + !endif +!else + # + # Disable ASSERT(), DEBUG(), DEBUG_CODE(), and DEBUG_CLEAR_MEMORY() + # + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x0 +!endif + +[PcdsPatchableInModule] +!if $(LOGGING) + # + # Enable DEBUG() messages of type DEBUG_ERROR, DEBUG_VERBOSE, DEBUG_INFO, + # DEBUG_WARN, and DEBUG_INIT + # + gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80400043 +!endif + [Components] TestFrameworkPkg/Library/EasLib/EntsLib.inf TestFrameworkPkg/Library/EfiTestLib/EfiTestLib.inf @@ -79,4 +126,19 @@ TestFrameworkPkg/PeiSctManageModule/PeiSctManageModule.inf =20 [BuildOptions] +!if $(TARGET) =3D=3D "DEBUG" + # + # Generate mixed C/ASM files for debug builds + # MSFT:*_*_*_CC_FLAGS =3D /FAsc +!endif + +!if $(NT32) + # + # If -D NT32 is set on command line to build, then build all components = to be + # compatible with NT32 environment debuggers. + # + DEBUG_*_*_DLINK_FLAGS =3D /EXPORT:InitializeDriver=3D$(IMAGE_ENTRY_POI= NT) /BASE:0x10000 /ALIGN:4096 /FILEALIGN:4096 /SUBSYSTEM:CONSOLE + NOOPT_*_*_DLINK_FLAGS =3D /EXPORT:InitializeDriver=3D$(IMAGE_ENTRY_POI= NT) /BASE:0x10000 /ALIGN:4096 /FILEALIGN:4096 /SUBSYSTEM:CONSOLE + RELEASE_*_*_DLINK_FLAGS =3D /ALIGN:4096 /FILEALIGN:4096 +!endif --=20 2.13.1.windows.2 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Fri Dec 27 02:05:19 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1502769449277319.44912756371525; Mon, 14 Aug 2017 20:57:29 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 61A6C21DFE91B; Mon, 14 Aug 2017 20:54:58 -0700 (PDT) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id D83A021DFC87C for ; Mon, 14 Aug 2017 20:54:56 -0700 (PDT) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP; 14 Aug 2017 20:57:21 -0700 Received: from mdkinney-mobl1.amr.corp.intel.com ([10.241.98.166]) by fmsmga006.fm.intel.com with ESMTP; 14 Aug 2017 20:57:20 -0700 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,376,1498546800"; d="scan'208";a="140268905" From: Michael D Kinney To: edk2-devel@lists.01.org Date: Mon, 14 Aug 2017 20:57:18 -0700 Message-Id: <20170815035718.1560-3-michael.d.kinney@intel.com> X-Mailer: git-send-email 2.13.1.windows.2 In-Reply-To: <20170815035718.1560-1-michael.d.kinney@intel.com> References: <20170815035718.1560-1-michael.d.kinney@intel.com> Subject: [edk2] [edk2-staging/edk2-test Patch V2 2/2] TestFrameworkPkg/TestProfile: Fix overlapping buffer ASSERT() X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Kinney , Andrew Fish , Felix Polyudov MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The patch is a bug fix for TestFrameworkPkg/Support/TestProfile driver. AsciiStrCpy() function was used to copy overlapping strings, which triggered an ASSERT(). The function was used on overlapping strings in a couple of places: 1. _alltrim(): AsciiStrCpy() is replaced with CopyMem(), which can handle overlapping buffers. 2. _prosessLine(): AsciiStrCpy() at the beginning of the function is removed. The call was redundant. The function was trying to move the data that have already been moved by _alltrim(). Cc: Andrew Fish Cc: Michael Kinney Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Felix Polyudov Reviewed-by: Felix Polyudov --- TestFrameworkPkg/Support/TestProfile/TestProfile.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TestFrameworkPkg/Support/TestProfile/TestProfile.c b/TestFrame= workPkg/Support/TestProfile/TestProfile.c index f02e9dfef..2476c5740 100644 --- a/TestFrameworkPkg/Support/TestProfile/TestProfile.c +++ b/TestFrameworkPkg/Support/TestProfile/TestProfile.c @@ -269,7 +269,7 @@ Routine Description: } =20 tmp[Index] =3D '\0'; - AsciiStrCpy (ptrStr, tmp); + CopyMem(ptrStr, tmp, Index + 1); =20 return ptrStr; } @@ -419,7 +419,7 @@ Routine Description: CHAR8 ptrValue[MAX_STRING_LEN + 1]; INI *ptrItem; =20 - AsciiStrCpy (ptrLine, _alltrim (ptrLine)); + _alltrim (ptrLine); =20 if (*ptrLine =3D=3D '#') { // it's a comment line --=20 2.13.1.windows.2 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel