From nobody Wed May 15 18:01:22 2024 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+112513+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+112513+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1702545656; cv=none; d=zohomail.com; s=zohoarc; b=Msv1vallit+HGjvjAl9hNnK7c6oyn4Em+IDJvSWsyb2B6zFzXs6XPDx9SPQ6EdSX6ZLr9ZM/yP1a0tvUZwxgJIt3mI3quAqX7xjcxYt7v+P1qLgsqFI4gjyjYyLAO6AR7B2cFMgdoOk0YPAhIuCUFH6WvpQ0cstvoF4fyk6fKFk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1702545656; h=Content-Type:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Sender:Subject:Subject:To:To:Message-Id; bh=Ku9IO7iIY+SEGlUy7PDn5gTfcgqx3EDOaCX+4Y/uDZE=; b=gZ+kUUDEgYXRbPsfWPD9Gj1PJ3aHlVg3i6IRss2iS7i1CE/aud2kQda+nK3Vduepumu/2v5d3FUuKdN2cIR5S8PqE8RMvJl++gswVXfW8AQ58SjOCukc7ojT1iRQAknR/2XPthz+aHhVKGI2jsn3zUMT9Q3YoSzjBViQRtgQUKs= 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+112513+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 1702545656446885.4191881512219; Thu, 14 Dec 2023 01:20:56 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=RBH0OGwt4y5bz7fHUBnycmU1OaBy/1yZxKIIiy8Yx6E=; 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=1702545656; v=1; b=fotNEbe29Ve8Gr/okIlCV9FQY4ml/NTm6wgoennkSl5CkrT/ulqRxAmycQGcZk/hiTI/A6Oo vC+bfvi9QbIu2ThHPZd0IPojtK57fUwv1wQg75AC5vf1dI5c9v9yie2klNpC//HiearYJSgaOLu vOMUdLUHHjjPTfpIsuaCjihc= X-Received: by 127.0.0.2 with SMTP id z0gfYY1788612xZBnJZLjAbI; Thu, 14 Dec 2023 01:20:56 -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: PUuKxS3sk4PsMCL34OHJ9unUx1787277AA= 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: X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1702545657600100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Leif Lindholm > Reviewed-by: Leif Lindholm Reviewed-by: Sami Mujawar --- ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.c | 100= ++++++-------------- 1 file changed, 31 insertions(+), 69 deletions(-) diff --git a/ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActio= nLib.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 =20 -/** - 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 =3D AsciiStrStr (Name, "/cygdrive/"); - if (Ptr =3D=3D NULL) { - return Name; - } - - for (Index =3D 9, Index2 =3D 0; (Index < (Size + 9)) && (Ptr[Index] !=3D= '\0'); Index++, Index2++) { - Temp[Index2] =3D Ptr[Index]; - if (Temp[Index2] =3D=3D '/') { - Temp[Index2] =3D '\\'; - } - - if (Index2 =3D=3D 1) { - Temp[Index2 - 1] =3D Ptr[Index]; - Temp[Index2] =3D ':'; - } - } - - return Temp; -} - /** Performs additional actions after a PE/COFF image has been loaded and re= located. =20 @@ -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", DeCygwin= PathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)), (UINTN)(Image= Context->ImageAddress + ImageContext->SizeOfHeaders))); - #elif __GNUC__ - // This may not work correctly if you generate PE/COFF directly as the= n the Offset would not be required - DEBUG ((DEBUG_LOAD | DEBUG_INFO, "add-symbol-file %a 0x%p\n", DeCygwin= PathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)), (UINTN)(Image= Context->ImageAddress + ImageContext->SizeOfHeaders))); - #else - DEBUG ((DEBUG_LOAD | DEBUG_INFO, "Loading driver at 0x%11p EntryPoint= =3D0x%11p\n", (VOID *)(UINTN)ImageContext->ImageAddress, FUNCTION_ENTRY_POI= NT (ImageContext->EntryPoint))); - #endif - } else { - DEBUG ((DEBUG_LOAD | DEBUG_INFO, "Loading driver at 0x%11p EntryPoint= =3D0x%11p\n", (VOID *)(UINTN)ImageContext->ImageAddress, FUNCTION_ENTRY_POI= NT (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=3D0x%11p\n", + (VOID *)(UINTN)ImageContext->ImageAddress, + FUNCTION_ENTRY_POINT (ImageContext->EntryPoint) + )); } =20 /** @@ -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", DeCygwinP= athIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)))); - #elif __GNUC__ - // This may not work correctly if you generate PE/COFF directly as the= n the Offset would not be required - DEBUG ((DEBUG_LOAD | DEBUG_INFO, "remove-symbol-file %a 0x%08x\n", DeC= ygwinPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)), (UINTN)(= ImageContext->ImageAddress + ImageContext->SizeOfHeaders))); - #else - DEBUG ((DEBUG_LOAD | DEBUG_INFO, "Unloading %a\n", ImageContext->PdbPo= inter)); - #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 -=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 (#112513): https://edk2.groups.io/g/devel/message/112513 Mute This Topic: https://groups.io/mt/103167036/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-