From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web10.10186.1670400469645124994 for ; Wed, 07 Dec 2022 00:07:49 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=gAdgo6zm; spf=pass (domain: intel.com, ip: 134.134.136.65, mailfrom: ray.ni@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1670400469; x=1701936469; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=XWJBePH2ExJkwDXpxOLlMWg6TR5Tf6hm7NTev9NlXN0=; b=gAdgo6zmlIAi7dt5AWPV2RTS5EsidhnrEnve/k4i86ChDX5EzyCAM9Mr GEz4rUpLN+5IirFQTj4qo1kzzZpTaapI+BjFbQDUB0jHzgkxlHCEna3dE YRqGqHdoqR8yL9VeHdcSf+uP2bqDKUSRjQ+fh3je/WTdB8dDYA5l8PwfJ Qymdibhj77Sojst11mcTE39xEThLoh6xfpyxsJClxLJIXUF+hThHk7ETJ PlXbxSKrmh3PKSy/qpOBqMPIjzoVOjCtjA7IN9I4REXKKbYrvHMYaZWrt o0qCAbGzMN+eQsR7YgSqD4Q9qk0Cme8hdygWQMYSntcIyHZmE4w+hdEI5 A==; X-IronPort-AV: E=McAfee;i="6500,9779,10553"; a="318686815" X-IronPort-AV: E=Sophos;i="5.96,223,1665471600"; d="scan'208";a="318686815" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Dec 2022 00:07:42 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10553"; a="771019264" X-IronPort-AV: E=Sophos;i="5.96,223,1665471600"; d="scan'208";a="771019264" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orsmga004.jf.intel.com with ESMTP; 07 Dec 2022 00:07:42 -0800 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Wed, 7 Dec 2022 00:07:41 -0800 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) by ORSMSX612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Wed, 7 Dec 2022 00:07:41 -0800 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16 via Frontend Transport; Wed, 7 Dec 2022 00:07:41 -0800 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (104.47.74.41) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.16; Wed, 7 Dec 2022 00:07:40 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IVeWuBLrNf6wInBbRS9G2fIbIH1sfihADO1juMc5T3rpPYRScxsL9uaJHd495O3snUPrJV2WpP1AEs+wXhUwZ0BMkpQ9lHck/hljVt3mG0SBywihCqDLrqfF/toXPLFKKk7/vOHPJ/UXFd0O+XXDFo82EtZuhf8UYWM8aCgraTomNMcyX/DEwQ4FVMnwyxTcDS58uMrsYT4a5C+vWfa47bv1fMd4LvWKsxgOb8Zk43i1+nuqzAolyQqTgRmVciwCkwOIiizUH4UT+ZsZyDxn8FKS9tCOVRM9JDDrsaAAw9FVR4ip+s3UeXHSnKsKeAnWAeELQWTOUC3CjqfEKBKShg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=9YZN4TFMl9nxqnZkqoDG0rdCLCj4FZR8zZUSyZilqV4=; b=Wed90ZXEJATUlHlHDTv4+IEZ75XoM2YHbGeebfcSHRpOcTTK9swkZdeeUMeWRYiDA6QADQRS8sSvYOYeingxo/PYyDnP4X5I7fMN2KS1mjq5eOA7rWJJtBLGC4NJeOdUib1nB4JnMYDgRDyNmFKXdZu7daxyiCr4GF4VlGvxIfelFIUHjPi6TloLA8To4OkSVlWpH0uqLk+OZSOLzn8pu7t9smGUkMOuBfoEJ0PBL4Mgg5p0Ho+/5YhTiunQJeCK/bgnpuR9BIclUky7OPwVZvZbNajd9Du/i1SeceoiINRSL9wZ0AF+lMwWOROkS57ELfHOogiFnwu5JC8IGgXqWQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from MWHPR11MB1631.namprd11.prod.outlook.com (2603:10b6:301:10::10) by CO6PR11MB5634.namprd11.prod.outlook.com (2603:10b6:5:35d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.14; Wed, 7 Dec 2022 08:07:39 +0000 Received: from MWHPR11MB1631.namprd11.prod.outlook.com ([fe80::69c8:2676:4674:1d2e]) by MWHPR11MB1631.namprd11.prod.outlook.com ([fe80::69c8:2676:4674:1d2e%12]) with mapi id 15.20.5880.014; Wed, 7 Dec 2022 08:07:39 +0000 From: "Ni, Ray" To: "devel@edk2.groups.io" , "Ni, Ray" CC: "Liu, Zhiguang" , Andrew Fish Subject: Re: [edk2-devel] [PATCH] EmulatorPkg/Win: Unload DLLs before reset Thread-Topic: [edk2-devel] [PATCH] EmulatorPkg/Win: Unload DLLs before reset Thread-Index: AQHZCHcBqSLDz+s1BUWHvgwBH1TrZq5iFOqw Date: Wed, 7 Dec 2022 08:07:39 +0000 Message-ID: References: <172DD36D81169CD7.13790@groups.io> In-Reply-To: <172DD36D81169CD7.13790@groups.io> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MWHPR11MB1631:EE_|CO6PR11MB5634:EE_ x-ms-office365-filtering-correlation-id: dec24bca-a42b-4426-b37b-08dad82a1bb4 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: b8vl4frmu3vW/U2SPiGgvKCqwM7Z/K/3E/hk5rnsTm9E/D/f6Op71PJvbRAkoq++MLBwOOI99GPKdCsaIQFXfX4OX7s1IA29LBkcqS5gSjrDU6VZFDdYknWHdean2OVG274OBefob1WVzhMeoCwgA/Bgfe0YMi6IPVw5MhNKFUz2dG2v76qa/BvVc0YX6y+Pv6MrA3lHajLnvIyRMI2+GRu9HAH0ggUiiXEw5wBSSYjrmtdFGx+3DCe8G3UaiDrbfGHOOFxxyaqAp39XaOLgn7UvQLj0/96Plo315a2sXYEdQjhkdf49nRvebJQYBT0rBicaQPn5lLNzB7IuSMWzI7K7pN67cinFw39QzXIFYTVr6P8YY7ljBAFMq29boyOtX0eKjzR3nywPwSB+zN4tzZD6WMsbcHBTLg8KsHa35XJDRI2NAHM4fb5kzGTldPNB+bmfwKMBSGNar+CUIYYaga/rCKE1RDLu8maA1OkIZ2jXIOvlQVvCg8PsowYeoVNp49Xhy6hrrb4nCrg9TwkNGI8yAa4uBr0TpZ1qEbdKXl0SHIfITt5OdNPBJ4xNaJTlyksSHDMDigBN0d3urzwr9kIYnQhw0qTCIt74HrYwU3LLcOpDOgbyfZhIuF3XZYYyj246keK8lahkajqU0yKWiUY/R04UlrQ4NLazksyrDzW6xuLGGaAFEZVQsz8SwuD2wbuOt1PARAfbWhTNcN9We/OQSwf6OTd75+nJKR3PnxU4RCgtwPwo738/MInUK6Sb+7sBRNWQUKcxYpeaFBaXeg== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR11MB1631.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(396003)(376002)(346002)(39860400002)(366004)(136003)(451199015)(186003)(83380400001)(38070700005)(86362001)(122000001)(82960400001)(2906002)(38100700002)(8936002)(52536014)(5660300002)(55016003)(478600001)(71200400001)(66446008)(966005)(9686003)(26005)(6506007)(7696005)(76116006)(41300700001)(64756008)(66476007)(66946007)(66556008)(8676002)(4326008)(53546011)(110136005)(54906003)(316002)(66899015)(33656002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?WgGKVlBvVTMJW39fWrMC/YjqtTjjFT7YP3Mwz53edQIdUX5Wx6me+61FFNA4?= =?us-ascii?Q?hvUDMY46gj548fq6QvnZVNo78xczFLw5X2EqAJxg128qA5u3u0t8kAFBS9NT?= =?us-ascii?Q?/PMauFlqynQhcTx8l6z2OO5evZIucSoue428XreYRiouMoXZrI0/Osj+dRRi?= =?us-ascii?Q?8OiZXaH9FY/clxtwIjwfQvHlEQOfui2s7EK78Y/+dFEo5t1yB6M/f72xTIL7?= =?us-ascii?Q?k7yv54X3lu3oyefSaJ/A8/cO3SotTFk048xGSIX3YnWyItb5nfCV+RBm2+fO?= =?us-ascii?Q?tCZEynf1tRUciITRcuOLu8JqfJKj659RY6eM92XwVAm1SiZlUxpvBbH6ok6f?= =?us-ascii?Q?sj9buAvCrm6aBPgfwePXh8RfVVXAuekdHkRgivqza9lBkiQh5lV0ufsw9mrr?= =?us-ascii?Q?JwPIm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OxLyk1EWL?= =?us-ascii?Q?22J3MklQkzBR5mjw3WyMMK2IZqkoofGblO87LAbp6ovQfw2XyPzGcJCfe5OW?= =?us-ascii?Q?6HGNcvQaORFPJlGAbMmYIR14NkS1z4F0EVKxHajJOLdcNln22OufPc7DG8P1?= =?us-ascii?Q?yElHrx4mntNjE4JMVados51MyKUQTNobV/DzR4rY84SS2kF+5HfjE6K7lbTH?= =?us-ascii?Q?IcrN95bUkIEVqeqzxuStuim+UtmJpfcEmcH1Nl7DA3FcuxcvQ/x9tciJJLvi?= =?us-ascii?Q?t7BYCPHwvMhzAkw1AsY=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MWHPR11MB1631.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: dec24bca-a42b-4426-b37b-08dad82a1bb4 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Dec 2022 08:07:39.1243 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: y0yLpb6Hus7NesoyTHWXZK3krar2JTHfPap5a4J7v+pV+ShIWCOPNlElRWwc2lYNWqKiHKYSFaDUY63pYUoFWQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR11MB5634 Return-Path: ray.ni@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Zhiguang, can you please help to review this patch? I guess Andrew is busy = on something. > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Ni, Ray > Sent: Monday, December 5, 2022 2:59 PM > To: devel@edk2.groups.io > Cc: Liu, Zhiguang ; Andrew Fish > Subject: [edk2-devel] [PATCH] EmulatorPkg/Win: Unload DLLs before reset >=20 > 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. >=20 > 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(). >=20 > Without this patch, source level debugging doesn't work after reset. >=20 > Signed-off-by: Ray Ni > Cc: Zhiguang Liu > Cc: Andrew Fish > --- > EmulatorPkg/Win/Host/WinHost.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) >=20 > diff --git a/EmulatorPkg/Win/Host/WinHost.c b/EmulatorPkg/Win/Host/WinHos= t.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 >=20 > ) >=20 > { >=20 > + UINTN Index; >=20 > + >=20 > ASSERT (ResetType <=3D EfiResetPlatformSpecific); >=20 > SecPrint (" Emu ResetSystem is called: ResetType =3D %s\n", mResetTyp= eStr[ResetType]); >=20 >=20 >=20 > if (ResetType =3D=3D EfiResetShutdown) { >=20 > exit (0); >=20 > } else { >=20 > + // >=20 > + // Unload all DLLs >=20 > + // >=20 > + for (Index =3D 0; Index < mPdbNameModHandleArraySize; Index++) { >=20 > + if (mPdbNameModHandleArray[Index].PdbPointer !=3D NULL) { >=20 > + SecPrint (" Emu Unload DLL: %s\n", mPdbNameModHandleArray[Index= ].PdbPointer); >=20 > + FreeLibrary (mPdbNameModHandleArray[Index].ModHandle); >=20 > + HeapFree (GetProcessHeap (), 0, mPdbNameModHandleArray[Index].Pd= bPointer); >=20 > + mPdbNameModHandleArray[Index].PdbPointer =3D NULL; >=20 > + } >=20 > + } >=20 > + >=20 > // >=20 > // Jump back to SetJump with jump code =3D ResetType + 1 >=20 > // >=20 > -- > 2.37.2.windows.2 >=20 >=20 >=20 > -=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/1712937 > Group Owner: devel+owner@edk2.groups.io > Unsubscribe: https://edk2.groups.io/g/devel/unsub [ray.ni@intel.com] > -=3D-=3D-=3D-=3D-=3D-=3D >=20