From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 06BEC7803E3 for ; Thu, 14 Dec 2023 09:20:56 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=d/NwMu6UL5A1cTxPJNr9kf7ZphvA9numGdIMV4arQyk=; c=relaxed/simple; d=groups.io; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type; s=20140610; t=1702545655; v=1; b=mGoSWZuEng9jxBXXhv2MVNHww8G2KhDyNCyVQl7n8zhcinSNAJVu6niueDCwXGNb24fO40ao AV4b/Rz/ffzHIIYISMUg+tMFWHldeaUqL8FkGW2KYv7TNiqVEJTMS9hv7F89DDR2iate6pxbQnw XuetCDeQTSaU8sshkTTbZwFY= X-Received: by 127.0.0.2 with SMTP id 9HE4YY7687511xLu8c7dxDCP; Thu, 14 Dec 2023 01:20:55 -0800 X-Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) by mx.groups.io with SMTP id smtpd.web10.18181.1702545654955024731 for ; Thu, 14 Dec 2023 01:20:55 -0800 X-Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-dbcc50d7dd3so2381822276.2 for ; Thu, 14 Dec 2023 01:20:54 -0800 (PST) X-Gm-Message-State: 3IP8R1BvW66FgU6ZR0Vzn1Jbx7686176AA= X-Google-Smtp-Source: AGHT+IHX6MuUSBkpEyhgEZFMnIhgB2jiT68E7lv3Nv5Rv2fjCXgKUc4hw1uOEOAYyr8xpLye+4sjFqg4 X-Received: from palermo.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:118a]) (user=ardb job=sendgmr) by 2002:a05:6902:52f:b0:db5:48c5:302e with SMTP id y15-20020a056902052f00b00db548c5302emr93836ybs.4.1702545654098; Thu, 14 Dec 2023 01:20:54 -0800 (PST) Date: Thu, 14 Dec 2023 10:20:46 +0100 Mime-Version: 1.0 Message-ID: <20231214092047.262009-1-ardb@google.com> Subject: [edk2-devel] [PATCH] ArmPkg/DebugPeCoffExtraActionLib: Drop RVCT and Cygwin support From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: quic_llindhol@quicinc.com, Ard Biesheuvel , Mike Beaton Precedence: Bulk 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,ardb@kernel.org List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Type: text/plain; charset="UTF-8" X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=mGoSWZuE; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=kernel.org (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io From: Ard Biesheuvel The DebugPeCoffExtraActionLib implemention in ArmPkg contains some cruft that dates back to the original RVCT based ARM port, and support for RVCT was dropped a while ago. Also drop the handling of Cygwin specific paths, which is highly unlikely to be still depended upon by anyone. Tweak the logic so that only two versions of the DEBUG() invocations remain: one for __GNUC__ when PdbPointer is set, and the fallback that just prints the image address and the address of the entrypoint. Cc: Mike Beaton Signed-off-by: Ard Biesheuvel --- ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.c | 100 ++++++-------------- 1 file changed, 31 insertions(+), 69 deletions(-) diff --git a/ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.c b/ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.c index 432112354fda..992c14d7ef9b 100644 --- a/ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.c +++ b/ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.c @@ -17,45 +17,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include -/** - If the build is done on cygwin the paths are cygpaths. - /cygdrive/c/tmp.txt vs c:\tmp.txt so we need to convert - them to work with RVD commands - - @param Name Path to convert if needed - -**/ -CHAR8 * -DeCygwinPathIfNeeded ( - IN CHAR8 *Name, - IN CHAR8 *Temp, - IN UINTN Size - ) -{ - CHAR8 *Ptr; - UINTN Index; - UINTN Index2; - - Ptr = AsciiStrStr (Name, "/cygdrive/"); - if (Ptr == NULL) { - return Name; - } - - for (Index = 9, Index2 = 0; (Index < (Size + 9)) && (Ptr[Index] != '\0'); Index++, Index2++) { - Temp[Index2] = Ptr[Index]; - if (Temp[Index2] == '/') { - Temp[Index2] = '\\'; - } - - if (Index2 == 1) { - Temp[Index2 - 1] = Ptr[Index]; - Temp[Index2] = ':'; - } - } - - return Temp; -} - /** Performs additional actions after a PE/COFF image has been loaded and relocated. @@ -71,23 +32,24 @@ PeCoffLoaderRelocateImageExtraAction ( IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext ) { - #if !defined (MDEPKG_NDEBUG) - CHAR8 Temp[512]; - #endif - +#ifdef __GNUC__ if (ImageContext->PdbPointer) { - #ifdef __CC_ARM - // Print out the command for the DS-5 to load symbols for this image - DEBUG ((DEBUG_LOAD | DEBUG_INFO, "add-symbol-file %a 0x%p\n", DeCygwinPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)), (UINTN)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders))); - #elif __GNUC__ - // This may not work correctly if you generate PE/COFF directly as then the Offset would not be required - DEBUG ((DEBUG_LOAD | DEBUG_INFO, "add-symbol-file %a 0x%p\n", DeCygwinPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)), (UINTN)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders))); - #else - DEBUG ((DEBUG_LOAD | DEBUG_INFO, "Loading driver at 0x%11p EntryPoint=0x%11p\n", (VOID *)(UINTN)ImageContext->ImageAddress, FUNCTION_ENTRY_POINT (ImageContext->EntryPoint))); - #endif - } else { - DEBUG ((DEBUG_LOAD | DEBUG_INFO, "Loading driver at 0x%11p EntryPoint=0x%11p\n", (VOID *)(UINTN)ImageContext->ImageAddress, FUNCTION_ENTRY_POINT (ImageContext->EntryPoint))); + DEBUG (( + DEBUG_LOAD | DEBUG_INFO, + "add-symbol-file %a 0x%p\n", + ImageContext->PdbPointer, + (UINTN)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders) + )); + return; } +#endif + + DEBUG (( + DEBUG_LOAD | DEBUG_INFO, + "Loading driver at 0x%11p EntryPoint=0x%11p\n", + (VOID *)(UINTN)ImageContext->ImageAddress, + FUNCTION_ENTRY_POINT (ImageContext->EntryPoint) + )); } /** @@ -106,21 +68,21 @@ PeCoffLoaderUnloadImageExtraAction ( IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext ) { - #if !defined (MDEPKG_NDEBUG) - CHAR8 Temp[512]; - #endif - +#ifdef __GNUC__ if (ImageContext->PdbPointer) { - #ifdef __CC_ARM - // Print out the command for the RVD debugger to load symbols for this image - DEBUG ((DEBUG_LOAD | DEBUG_INFO, "unload symbols_only %a\n", DeCygwinPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)))); - #elif __GNUC__ - // This may not work correctly if you generate PE/COFF directly as then the Offset would not be required - DEBUG ((DEBUG_LOAD | DEBUG_INFO, "remove-symbol-file %a 0x%08x\n", DeCygwinPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)), (UINTN)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders))); - #else - DEBUG ((DEBUG_LOAD | DEBUG_INFO, "Unloading %a\n", ImageContext->PdbPointer)); - #endif - } else { - DEBUG ((DEBUG_LOAD | DEBUG_INFO, "Unloading driver at 0x%11p\n", (VOID *)(UINTN)ImageContext->ImageAddress)); + DEBUG (( + DEBUG_LOAD | DEBUG_INFO, + "remove-symbol-file %a 0x%08x\n", + ImageContext->PdbPointer, + (UINTN)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders) + )); + return; } +#endif + + DEBUG (( + DEBUG_LOAD | DEBUG_INFO, + "Unloading driver at 0x%11p\n", + (VOID *)(UINTN)ImageContext->ImageAddress + )); } -- 2.43.0.472.g3155946c3a-goog -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#112513): https://edk2.groups.io/g/devel/message/112513 Mute This Topic: https://groups.io/mt/103167036/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-