mirror of
				https://github.com/acidanthera/audk.git
				synced 2025-10-31 11:13:53 +01:00 
			
		
		
		
	EmulatorPkg/Win: Unload DLLs before reset
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@intel.com> Reviewed-by: Zhiguang Liu <zhiguang.liu@intel.com> Cc: Andrew Fish <afish@apple.com>
This commit is contained in:
		
							parent
							
								
									2280af5ff8
								
							
						
					
					
						commit
						4e17aba4b5
					
				| @ -226,12 +226,26 @@ WinReset ( | |||||||
|   IN VOID            *ResetData OPTIONAL |   IN VOID            *ResetData OPTIONAL | ||||||
|   ) |   ) | ||||||
| { | { | ||||||
|  |   UINTN  Index; | ||||||
|  | 
 | ||||||
|   ASSERT (ResetType <= EfiResetPlatformSpecific); |   ASSERT (ResetType <= EfiResetPlatformSpecific); | ||||||
|   SecPrint ("  Emu ResetSystem is called: ResetType = %s\n", mResetTypeStr[ResetType]); |   SecPrint ("  Emu ResetSystem is called: ResetType = %s\n", mResetTypeStr[ResetType]); | ||||||
| 
 | 
 | ||||||
|   if (ResetType == EfiResetShutdown) { |   if (ResetType == EfiResetShutdown) { | ||||||
|     exit (0); |     exit (0); | ||||||
|   } else { |   } else { | ||||||
|  |     //
 | ||||||
|  |     // Unload all DLLs
 | ||||||
|  |     //
 | ||||||
|  |     for (Index = 0; Index < mPdbNameModHandleArraySize; Index++) { | ||||||
|  |       if (mPdbNameModHandleArray[Index].PdbPointer != NULL) { | ||||||
|  |         SecPrint ("  Emu Unload DLL: %s\n", mPdbNameModHandleArray[Index].PdbPointer); | ||||||
|  |         FreeLibrary (mPdbNameModHandleArray[Index].ModHandle); | ||||||
|  |         HeapFree (GetProcessHeap (), 0, mPdbNameModHandleArray[Index].PdbPointer); | ||||||
|  |         mPdbNameModHandleArray[Index].PdbPointer = NULL; | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     //
 |     //
 | ||||||
|     // Jump back to SetJump with jump code = ResetType + 1
 |     // Jump back to SetJump with jump code = ResetType + 1
 | ||||||
|     //
 |     //
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user