Date
1 - 3 of 3
[PATCH] EmulatorPkg/Win: Unload DLLs before reset
Ni, Ray
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 <ray.ni@...> Cc: Zhiguang Liu <zhiguang.liu@...> Cc: Andrew Fish <afish@...> --- 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=0D )=0D {=0D + UINTN Index;=0D +=0D ASSERT (ResetType <=3D EfiResetPlatformSpecific);=0D SecPrint (" Emu ResetSystem is called: ResetType =3D %s\n", mResetTypeS= tr[ResetType]);=0D =0D if (ResetType =3D=3D EfiResetShutdown) {=0D exit (0);=0D } else {=0D + //=0D + // Unload all DLLs=0D + //=0D + for (Index =3D 0; Index < mPdbNameModHandleArraySize; Index++) {=0D + if (mPdbNameModHandleArray[Index].PdbPointer !=3D NULL) {=0D + SecPrint (" Emu Unload DLL: %s\n", mPdbNameModHandleArray[Index].= PdbPointer);=0D + FreeLibrary (mPdbNameModHandleArray[Index].ModHandle);=0D + HeapFree (GetProcessHeap (), 0, mPdbNameModHandleArray[Index].PdbP= ointer);=0D + mPdbNameModHandleArray[Index].PdbPointer =3D NULL;=0D + }=0D + }=0D +=0D //=0D // Jump back to SetJump with jump code =3D ResetType + 1=0D //=0D --=20 2.37.2.windows.2 |
|
Ni, Ray
Zhiguang, can you please help to review this patch? I guess Andrew is busy on something.
toggle quoted message
Show quoted text
-----Original Message----- |
|
Zhiguang Liu
Yes, the patch looks fine.
toggle quoted message
Show quoted text
Reviewed-by: Zhiguang Liu <zhiguang.liu@...> -----Original Message----- |
|