From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (EUR04-DB3-obe.outbound.protection.outlook.com [40.107.6.86]) by mx.groups.io with SMTP id smtpd.web09.4508.1626256413782859472 for ; Wed, 14 Jul 2021 02:53:34 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=PKhi4WUt; spf=pass (domain: arm.com, ip: 40.107.6.86, mailfrom: artem.kopotev@arm.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YleOcmPNZkisxBPLhgmzZ80SKpIg/XRf1aFJ+UK1jdc=; b=PKhi4WUtFfQg9FCKYNCRLBu9CZ8Mt1oNvD2qDmr7a6KSvJl2Gj9k5xj5YaP8HS82RlGlNQpSEobT1mz6T3Ndtry+/rXFURbT6V/WAxRcoJikn+4epMXsyhOb0SKsHj/0ojGwt4qx9gxodJIv7682BjvY8sT3L8leb2ztI1E0AQI= Received: from FR0P281CA0070.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:49::20) by AM0PR08MB2961.eurprd08.prod.outlook.com (2603:10a6:208:66::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.22; Wed, 14 Jul 2021 09:53:31 +0000 Received: from VE1EUR03FT008.eop-EUR03.prod.protection.outlook.com (2603:10a6:d10:49:cafe::d0) by FR0P281CA0070.outlook.office365.com (2603:10a6:d10:49::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4352.8 via Frontend Transport; Wed, 14 Jul 2021 09:53:31 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; edk2.groups.io; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;edk2.groups.io; dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT008.mail.protection.outlook.com (10.152.18.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21 via Frontend Transport; Wed, 14 Jul 2021 09:53:30 +0000 Received: ("Tessian outbound bbfc4df8f27e:v99"); Wed, 14 Jul 2021 09:53:30 +0000 X-CR-MTA-TID: 64aa7808 Received: from b724c6c8fea1.3 by 64aa7808-outbound-1.mta.getcheckrecipient.com id FE0EC306-05D2-48D2-A2B4-F453408F2D2B.1; Wed, 14 Jul 2021 09:53:19 +0000 Received: from EUR03-AM5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id b724c6c8fea1.3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 14 Jul 2021 09:53:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iAUvoEDEMLp88UR5iSzaN1QeCtCvxjEBJjoMUJRYPah0f7bueZHRPsCTtTqMdfR04q2mQFRfzP2FYL6Yv8qKkrPIn0uSPDNr0TiTZciT/DII54goTfIkXtTDg77oYnx/iOyc56qVpyrlv3F6w9m6BjmZXKfFf5VUA2Nq1l/1dP9s4gvrF/cM+vFJCfhoFjVY7XXk31GN6/5VsVd+JmU4d/21U+Ke1gNnmhVnR8S8MrVeyycht6ebv8UtfluRh5LzxWQmS1wSRvHuhoNToHP3ETYPvnETHwOYNate9aeC0jIYRq/H2WDnXfiW7ODg3ztMBotiMRIgu3DyhqHWTBDMCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YleOcmPNZkisxBPLhgmzZ80SKpIg/XRf1aFJ+UK1jdc=; b=a+C6iGUcxuOjRe4adTSZZYlvQOh78OHG0ID2/lVxD0afD5uDNgtRg9BBQ4wg2kABLcRjlIqaxQX0UA0yZziL3bDSeR0zCSGhcy34p59ClAl7wSdJhzMsMjk35MLAuxuHMbDrmUWypABSn9L1QPQ6WeNKrRnwI4yY3kzLt8dbmPWNRo27bi0gNvbW5MYIOwGTyoziPgjg682wZD889GI1kHjd1pWXx9Qm1AFZC6XBb9fp6RNWGKX9N0+nLEz4xxGOtOhplsAn7bLt5A3KSRGvCVPFyLDNPBNTjnJQHBUIpCImbM49C3zSJk0Qc2QNFFKkgpfYn3K2Gatbl8jYwll10g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YleOcmPNZkisxBPLhgmzZ80SKpIg/XRf1aFJ+UK1jdc=; b=PKhi4WUtFfQg9FCKYNCRLBu9CZ8Mt1oNvD2qDmr7a6KSvJl2Gj9k5xj5YaP8HS82RlGlNQpSEobT1mz6T3Ndtry+/rXFURbT6V/WAxRcoJikn+4epMXsyhOb0SKsHj/0ojGwt4qx9gxodJIv7682BjvY8sT3L8leb2ztI1E0AQI= Received: from DBAPR08MB5557.eurprd08.prod.outlook.com (2603:10a6:10:1a1::13) by DB6PR0801MB1622.eurprd08.prod.outlook.com (2603:10a6:4:32::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.24; Wed, 14 Jul 2021 09:53:18 +0000 Received: from DBAPR08MB5557.eurprd08.prod.outlook.com ([fe80::ad71:5354:4c53:6c4f]) by DBAPR08MB5557.eurprd08.prod.outlook.com ([fe80::ad71:5354:4c53:6c4f%7]) with mapi id 15.20.4331.021; Wed, 14 Jul 2021 09:53:18 +0000 From: "Artem Kopotev" To: "devel@edk2.groups.io" , Artem Kopotev CC: Leif Lindholm , Ard Biesheuvel , Sami Mujawar Subject: Re: [edk2-devel] [PATCH v1 1/1] ArmPlatformPkg/Scripts: Create add-symbol-file commands from UEFI console Thread-Topic: [edk2-devel] [PATCH v1 1/1] ArmPlatformPkg/Scripts: Create add-symbol-file commands from UEFI console Thread-Index: AQHXYg49J2vsxXTCiUyWIdZF6ZkTbqtCZ5nw Date: Wed, 14 Jul 2021 09:53:18 +0000 Message-ID: References: <20210615151116.972-1-artem.kopotev@arm.com> <1688D28138E4C4FE.1864@groups.io> In-Reply-To: <1688D28138E4C4FE.1864@groups.io> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: 0E0F450F187A4A42A0B4707ADEF076A0.0 x-checkrecipientchecked: true Authentication-Results-Original: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=arm.com; x-ms-publictraffictype: Email X-MS-Office365-Filtering-Correlation-Id: d866b2e6-2777-4cda-c7e2-08d946ad3c87 x-ms-traffictypediagnostic: DB6PR0801MB1622:|AM0PR08MB2961: x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:1824;OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: CoUGMKIXXwSTP+VOtCxesZSayhjoFaD08l6hs/0ggEP54V9eNjgUA33hQD23O3676Hnpe/4AsrjkXCSUJge23QUD1i3dJOxiobv0rja6s9IrgOy8jWHRxpoVPwXuUeRuz2P5sTCN+OIxf1560amAktjEj3edgH/EjYp8rhKsaWb3pujqli6EyQrhqrqZLuKOzrECaouPLkCtmLP777h0qHW8yrbXEVbxkjg+FiZvWNfA+GxAHjRFosHuIf0xZRZh59luxt9t9vrzV5fOlAD/DndJeIAkmsmVdvMftNIQS1ceaUvdR8GWGIY61nhux2ZHxb9TuElDdBE5g4LfroTm4fGaLXMaCLd5fW5GjkHHrZXXSz1muLWLqN6b5ss/FzId04eocfDeF1GhQQ/oeDtpp0cdDUgME8en4fYNIGu9oNCbdElBsHIWyXbWfOTL9RPArZq6E1hooq07crLKX3PP9xAmlcdGAuFdSiT+Q8+pWbuDzMEGMgsCHkRlax3gB6EcQVV3ET9p633jf1vUMcGyICBGRBZI9siXyNIavmyfjMUx3SP3RQ3gi49Vh7S4tNvXFXvgg9QWxanNyjzjVVLzAtHzIzZJfXQeUZl5bJW0EDvTLwoWKbcbAMZZRiw+f0G2kdMLmsE5d6cdC7XKcOeLiV5ErVJAqjMmC2Im4F1NjyVQSrwNdd3nG1zJ8C9wNVg3fjvPUybHw3AJ8k9SPphYashb2mfA+UYdxF5HWPyiDDD8OLA6je4LNxz18g6VgDiLLzY7PEYZP7spP7u2KKxo1XcishqiYztUtJpsveQQHFMvBK1IYxj1WvwF6WGmrZCUBDglfG+rfRpNCUUtnnEOlg== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DBAPR08MB5557.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(136003)(366004)(396003)(376002)(346002)(39860400002)(316002)(76116006)(55016002)(9686003)(66476007)(52536014)(66446008)(26005)(6506007)(122000001)(38100700002)(966005)(478600001)(53546011)(110136005)(86362001)(186003)(83380400001)(33656002)(54906003)(71200400001)(7696005)(64756008)(66946007)(5660300002)(19627235002)(2906002)(66556008)(4326008)(8676002)(8936002)(38070700004);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?jHw1wAwP6Q4FKoLMh0X9C5FxJ2qqykENkg79aCUiorEui5PvE7phDFDJkHhX?= =?us-ascii?Q?5AZlllPGymPYHzyWtZdgEPyUnxWQ2JYQ1jFc53qlNIW9u14rSEKM9DEUTq9/?= =?us-ascii?Q?HwSZII3koyo/KC5JO2LVWl01m1RceV1nkB5r/3G4bE81cvTeRTcPj4POJg4Q?= =?us-ascii?Q?J85K7MwqQN7RZnZC9X4cw/jus7fC/zl8PiHNWuWc7geBZAKP51RHdAE0Sb7l?= =?us-ascii?Q?Y5VgZ6Pa1FyFhJW8h8szSpBaim6aZ6nHQYB/5QheeiFpNiiIKMTF5Prkh1+V?= =?us-ascii?Q?Zf7GtZaQNKDwe8M1NE95Po7D2kvc+qB43AoB5w3o2XqzdckypODJwOx0U8k8?= =?us-ascii?Q?xUR6OD+zQP1DDJHNmlnODSdr0F/eFEgcLfddoPWHpHGw2G740kxtJrHIVA97?= =?us-ascii?Q?tv5cMQfGQkapNMfEDnIlCKq2mn3aC+zNjBjFFEQXqwrohElZp6WgJb3JhsFp?= =?us-ascii?Q?6NI2GLP1zugEoeVfjc4WqG2uZYeruc8a6uj0YHWhDPXDClOdX358liIdHgTm?= =?us-ascii?Q?Alw8rr/VtKBQXPdj3yp7VNnU2ckIJ9JyPCgivrEnhfWkcMp7u0jw0O5qfptd?= =?us-ascii?Q?s5WxAT+vzdqiAahidgcy137qGxkY9aYUV10tgUgS79SZfZCpLtxw5ABxcK8e?= =?us-ascii?Q?FIpRIMJobdCkoe6d6Nj+gV8bi106bVShisGwUY0KInj8KpPZph0kV1p8x7lS?= =?us-ascii?Q?ZxpIgIK9t7Pwaqgce3Xb/spqM4AH/ajdj8u+86fplS3ekeN4Enw6uW6VEIcj?= =?us-ascii?Q?7G24cY7fEdh8tBHQTiTt8/BTd7oHtpw3vXhfOY8xnejumlfaSgYNxwGEbj2L?= =?us-ascii?Q?nQIL36io6tLZSC60rjhA2ZvfYA+iexfc8BmFcxSO4sXPcvyEJtUYsX8PHnCH?= =?us-ascii?Q?7/uJhAb/z8mYdHDbhEttnGTRUhORZev7Ej8K6bF14SWp1MJcSjsPJ7BWdDO9?= =?us-ascii?Q?HHRzodOtQgQgbXjTvmt84lKd7Urq/WFu2fENgjLno8oE9glcn/umdUDzOw/3?= =?us-ascii?Q?drNTcYsvRyIQ1SI/FUWxr2e8MSAquUpRJq5d71VddRFph3yGxg70dioufFhc?= =?us-ascii?Q?gq8klsvqkkrijmElZxuhlA4MboVfK1VAFM5EbpSSkZTOH0GPJ1DlPe+lOm8k?= =?us-ascii?Q?0OLcAEOdeTEfgv2MYiXB5G2mR0VGu6e3MaUSvWynUjjlGBDMCcxRC8wBtco7?= =?us-ascii?Q?OaibTFjAWHFqYiupzXp9gIwEJSnNpMLjeLk9edGh+AijO4Cx7I4yoVsdsWb0?= =?us-ascii?Q?iUCIt6TKXtGYCiRWjfaX26tX8KvK//3dIl4d32lwJafpupSG1Grb2IE2lSKT?= =?us-ascii?Q?BM3PPZ9FGnOU61ahos54YIYK?= MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB1622 Original-Authentication-Results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=arm.com; Return-Path: Artem.Kopotev@arm.com X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT008.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 2ed6fe94-b692-45d1-fc17-08d946ad3524 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DPtrZpYcyB3BEBzK8ucWBe1zB93Op4gd4C4Xa386w0adtwWcWFpEHLo01MN4IJgss2Frz1dw2kt6PbLBXz9VbUp/gUP07ZYam6MMCa5Rz1nPEeQUrr0BPwObL7YYEKnUK6+PrVuhEq2JN32j9gSpO9gOr9TS937sCz4CVnfYQo4FMOSfoEFdae7VpA6VDh6PBu6AfuEivD59c1RYFhIgOPC7topsrHhTrrLTy//NvCtInJyv8xF/3Jl/1K3YKAL3RBzozKL8F9JxW1sB89tGHeLNAgAhjV+nngdtd04EHMHLznjPxrE7LkCYGVZQrLt6v6ave49H9lQ/pUfuhLeAqkLB4xXFpS0/9ccwW7BPr0XzskSbniTJMMDC0BOtl95Hxsaz67K/FNRRMWl1LYsKfMM1gPNd+CoY24ogd+vxLvAjqEEpReb2gjcVWcw+sHuXb9NVUnSYcZA5s7zE+zGN1tjJXMApdXoilA/P3Lr4kDIA6fMQV5RSG4dSe+o/AMc6rL7Yb1TGCnfNuS3Mw4gBtf0sbuse36nufnDBc4Mstc/YixPlaK/gE+eWZrLQMTf7o+4U0GVAVn8v2z9A/qnAPdLbzmAKazih0+yVZrbwaOt9367uDTuQGYqoHvEWE+DfkEDre01sumcqppcQXya0VyC6VT7rlEqo3NtZm6HFiFfhRtU/IYKsIX5R5I7Ltk/6oSZMndAwslUaFJ6uquOpMFQtsWS/E3ip88nTq+vSEzoE8uHw7/PKInjTBQ2gf4+4f+780WervnYACKFX3ioER45zjtJHxemNywIQgEc/8ZvcbFqlsLCMXEjih9yZKqL+3Qc/OiN4upRmTvgMensdZA== X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(4636009)(136003)(376002)(396003)(346002)(39860400002)(36840700001)(46966006)(82740400003)(966005)(186003)(2906002)(82310400003)(36860700001)(81166007)(26005)(336012)(70586007)(53546011)(54906003)(7696005)(70206006)(55016002)(478600001)(6506007)(110136005)(8676002)(356005)(19627235002)(9686003)(5660300002)(4326008)(8936002)(86362001)(83380400001)(316002)(47076005)(52536014)(33656002);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jul 2021 09:53:30.6876 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d866b2e6-2777-4cda-c7e2-08d946ad3c87 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT008.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB2961 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hello, This is the second email, which originally didn't have CC to maintainers. Best regards, Artem. -----Original Message----- From: devel@edk2.groups.io On Behalf Of Artem Kopot= ev via groups.io Sent: 15 June 2021 16:11 To: devel@edk2.groups.io Subject: [edk2-devel] [PATCH v1 1/1] ArmPlatformPkg/Scripts: Create add-sy= mbol-file commands from UEFI console cmd_load_symbols.py can only load symbols from FV. Add the possibility to = use UEFI console output to calculate dll load address and send add-symbol-f= ile commands directly to ArmDS debugger dll load address can't be used directly from UEFI output, see comment in DebugPeCoffExtraActionLib: "This may not work correctly if you generate PE= /COFF directly as then the Offset would not be required". 1) Use objdump -S module.dll | grep <_ModuleEntryPoint> to get offset in d= ll (offset) 2) Use Entrypoint=3D
from UEFI console output (entrypoint) 3) dll load address is (entrypoint)-(offset) Signed-off-by: Artem Kopotev Change-Id: I3ac5ea761254a346bbb5806fb089b0979419bc01 --- ArmPlatformPkg/Scripts/Ds5/cmd_load_symbols.py | 17 ++++- ArmPlatformPkg/Scripts/Ds5/console_loader.py | 68 ++++++++++++++++++++ 2 files changed, 83 insertions(+), 2 deletions(-) diff --git a/ArmPlatformPkg/Scripts/Ds5/cmd_load_symbols.py b/ArmPlatformP= kg/Scripts/Ds5/cmd_load_symbols.py index de4332edc7d4..89d2f28ba27d 100644 --- a/ArmPlatformPkg/Scripts/Ds5/cmd_load_symbols.py +++ b/ArmPlatformPkg/Scripts/Ds5/cmd_load_symbols.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2011-2013, ARM Limited. All rights reserved. +# Copyright (c) 2011-2021, Arm Limited. All rights reserved. # # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -7,6 +7,8 @@ from = arm_ds.debugger_v1 import Debugger from arm_ds.debugger_v1 import DebugExc= eption +from console_loader import load_symbol_from_console + import re, sys, getopt import edk2_debugger @@ -21,12 +23,16 @@ def usage(): print "-m,--sysmem=3D(base,size): System Memory region" print "-f,--fv=3D(base,size): Firmware region" print "-r,--rom=3D(base,size): ROM region" + print "-i,--input=3D: Filename for the EDK2 console output" + print "-o,--objdump=3D: Path to the objdump tool" verbose =3D False load_all =3D False report_file =3D None +input_file =3D None +objdump =3D None regions =3D [] -opts,args =3D getopt.getopt(sys.argv[1:], "hvar:vm:vr:vf:v", ["help","ver= bose","all","report=3D","sysmem=3D","rom=3D","fv=3D"]) +opts,args =3D getopt.getopt(sys.argv[1:], "hvar:i:o:vm:vr:vf:v", +["help","verbose","all","report=3D","sysmem=3D","rom=3D","fv=3D","input= =3D","objd +ump=3D"]) if (opts is None) or (not opts): report_file =3D '../../../report.log' else: @@ -55,6 +61,10 @@ else: elif o in ("-r","--rom"): region_type =3D edk2_debugger.ArmPlatformDebugger.REGION_TYPE= _ROM regex =3D region_reg + elif o in ("-i","--input"): + input_file =3D a + elif o in ("-o", "--objdump"): + objdump =3D a else: assert False, "Unhandled option (%s)" % o @@ -94,3 +104,6 @@ except Exception, (ErrorClass, ErrorMessage): print "Error(%s): %s" % (ErrorClass, ErrorMessage) except DebugExcep= tion, de: print "DebugError: %s" % (de.getMessage()) + +if input_file: + load_symbol_from_console(ec, input_file, objdump, verbose) diff --git a/ArmPlatformPkg/Scripts/Ds5/console_loader.py b/ArmPlatformPkg= /Scripts/Ds5/console_loader.py new file mode 100644 index 000000000000..0ce217876d95 --- /dev/null +++ b/ArmPlatformPkg/Scripts/Ds5/console_loader.py @@ -0,0 +1,68 @@ +# +# Copyright (c) 2021, Arm Limited. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent # + +from arm_ds.debugger_v1 import DebugException + +import subprocess, os, edk2_debugger, re + +def get_module_name(line): + path =3D line.rsplit(' ')[1] + return os.path.splitext(os.path.basename(path))[0] + +def get_module_path(line): + return line.rsplit(' ')[1] + +def get_module_entrypoint(list, module_name): + line =3D [i for i in list if module_name in i and re.search(r'\b'+mod= ule_name+r'\b', i)] + if len(line) =3D=3D 0: + # Module was not loaded using DxeDispatcher or PeiDispatcher. It = is a SEC module + # Symbols for these modules are loaded from FV, not from console = log + return None + + entrypoint_str =3D line[0].rsplit(' ')[4] + return entrypoint_str.rsplit('=3D')[1] + +def load_symbol_from_console(ec, console_file, objdump, verbose): + if objdump is None: + print "Error: A path to objdump tool is not specified, but -i par= ameter is provided" + elif not os.path.exists(objdump): + print "Error: Provided path to objdump is invalid: %s" % objdump + elif not os.path.exists(console_file): + print "Error: UEFI console file is not found: %s" % console_file + else: + + full_list =3D open(console_file).read().splitlines() + + efi_list =3D [i for i in full_list if "EntryPoint=3D" in i] + + full_list =3D dict.fromkeys(full_list) + full_list =3D [i for i in full_list if "add-symbol-file" in i] + + module_dict =3D {} + + for line in full_list: + name =3D get_module_name(line) + module_dict[name] =3D (get_module_path(line), + get_module_entrypoint(efi_list, name)) + + for module in module_dict: + entrypoint_addr =3D module_dict[module][1] + + if entrypoint_addr is not None: + path =3D module_dict[module][0] + if not os.path.exists(path): + print "Module not found: " + path + ". Skipping..." + continue + + sp =3D subprocess.Popen([objdump,'-S', path], stdout =3D + subprocess.PIPE) + + objdump_out =3D sp.stdout.readlines() + entrypoint_record =3D [i for i in objdump_out if + "<_ModuleEntryPoint>" in i] + + entrypoint_offset =3D entrypoint_record[0].split(' ')[0] + + load_addr =3D int(entrypoint_addr, 16) - + int(entrypoint_offset, 16) + + edk2_debugger.load_symbol_from_file(ec, path, + load_addr, verbose) -- 2.17.1 IMPORTANT NOTICE: The contents of this email and any attachments are confi= dential and may also be privileged. If you are not the intended recipient, = please notify the sender immediately and do not disclose the contents to an= y other person, use it for any purpose, or store or copy the information in= any medium. Thank you.