From nobody Sun May 5 02:38:50 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+96943+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+96943+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1670223505; cv=none; d=zohomail.com; s=zohoarc; b=cEIIi7WOarnyj/1SSsdSaJrgOdvWNIoOG29Am0VFZfv1dUpoGCNE4LGnd3t3kdFFi9cvUZEAm4MKCXRilQ2TGF4ljENiWO/XzgyUZ6BrmX4qEoycoNM471o5kiebevyr/GThbqxl3HfSAghyxzgQdLOiWG3mHWVNvdGnZJ8/ch8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1670223505; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=SA2HC5As5Nqup4wsB9vNRtfYKKeAmGn0QlN8ZBjJQw4=; b=mbl7zbKAWKQkM95xpD8qTaVPToqt54PaXFJcbWyz+Muvkb+sMzl0AeJVCHGkIQd77nvU+vNkj2lXesqc9E2LG1YkS07yCRfrhhzzj8Tbky2TexAy7YiwugM4sFlG2h6rABGwiOq1IQnna25vt7Ela7qKRP690ZrqChC7iWKSwiY= 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+96943+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 1670223505169492.3397384941816; Sun, 4 Dec 2022 22:58:25 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id Bfk2YY1788612xxg7ynjyIyT; Sun, 04 Dec 2022 22:58:24 -0800 X-Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web11.9418.1670223503374099593 for ; Sun, 04 Dec 2022 22:58:23 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10551"; a="378436078" X-IronPort-AV: E=Sophos;i="5.96,218,1665471600"; d="scan'208";a="378436078" X-Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2022 22:58:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10551"; a="645712888" X-IronPort-AV: E=Sophos;i="5.96,218,1665471600"; d="scan'208";a="645712888" X-Received: from ray-dev.ccr.corp.intel.com ([10.239.158.139]) by orsmga002.jf.intel.com with ESMTP; 04 Dec 2022 22:58:17 -0800 From: "Ni, Ray" To: devel@edk2.groups.io Cc: Zhiguang Liu , Andrew Fish Subject: [edk2-devel] [PATCH] EmulatorPkg/Win: Unload DLLs before reset Date: Mon, 5 Dec 2022 14:58:42 +0800 Message-Id: <20221205065842.1792-1-ray.ni@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,ray.ni@intel.com X-Gm-Message-State: x76OaHD7EIutouL3nDtcvztnx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1670223504; bh=tlQHvI2xn0daryAj55r9vN7fRP6XzOZfMT/kBvwzf0w=; h=Cc:Date:From:Reply-To:Subject:To; b=OazpHUqrr0nQST27YECr2NGmU4OFzQ0IqdjPtmb/B05GnIMiZatazRmsi0yQIGUUgOz gKF8ReeiOM/pH0pVI+hvaLFf7kiLZdnk7MGQLD/MCZQaJh+zNgNqAEsFQUeRruyUos4gv zNVzFw4v4NmDmBD5aLy0OOi8pSZpNBAxx2A= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1670223506841100001 Content-Type: text/plain; charset="utf-8" EmulatorPkg/Win calls LoadLibraryEx() when the corresponding DLL file is found for each PEIM or DXE driver. The module entry point is changed to point to the entry point from the DLL. This helps to notify Visual Studio that a new windows module is loaded and corresponding symbol parsing is performed for source level debugging. But entry point from the DLL is only executed when the module is not loaded by AddModHandle(). When reset happens, we need to clear the DLL loading so that in next boot the module can be loaded again by AddModHandle(). Without this patch, source level debugging doesn't work after reset. Signed-off-by: Ray Ni Cc: Zhiguang Liu Cc: Andrew Fish --- EmulatorPkg/Win/Host/WinHost.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/EmulatorPkg/Win/Host/WinHost.c b/EmulatorPkg/Win/Host/WinHost.c index 096292f95a..084cd4cbd7 100644 --- a/EmulatorPkg/Win/Host/WinHost.c +++ b/EmulatorPkg/Win/Host/WinHost.c @@ -226,12 +226,26 @@ WinReset ( IN VOID *ResetData OPTIONAL ) { + UINTN Index; + ASSERT (ResetType <=3D EfiResetPlatformSpecific); SecPrint (" Emu ResetSystem is called: ResetType =3D %s\n", mResetTypeS= tr[ResetType]); =20 if (ResetType =3D=3D EfiResetShutdown) { exit (0); } else { + // + // Unload all DLLs + // + for (Index =3D 0; Index < mPdbNameModHandleArraySize; Index++) { + if (mPdbNameModHandleArray[Index].PdbPointer !=3D NULL) { + SecPrint (" Emu Unload DLL: %s\n", mPdbNameModHandleArray[Index].= PdbPointer); + FreeLibrary (mPdbNameModHandleArray[Index].ModHandle); + HeapFree (GetProcessHeap (), 0, mPdbNameModHandleArray[Index].PdbP= ointer); + mPdbNameModHandleArray[Index].PdbPointer =3D NULL; + } + } + // // Jump back to SetJump with jump code =3D ResetType + 1 // --=20 2.37.2.windows.2 -=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 (#96943): https://edk2.groups.io/g/devel/message/96943 Mute This Topic: https://groups.io/mt/95464183/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-