]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg/DebugPeCoffExtraActionLib: Checked the ImageContext->PdbPointer is not null
authoroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 5 Mar 2013 23:01:53 +0000 (23:01 +0000)
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 5 Mar 2013 23:01:53 +0000 (23:01 +0000)
This check prevents to get an assertion in case of null PdbPointer.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14163 6f19259b-4bc3-4df7-8a09-765794883524

ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.c

index 6459d51cffc0b4af3b9b1dc9d99bd04a4213419c..6d0bb988ea3faa5639c86bc784577107e6c9e2ca 100755 (executable)
@@ -83,20 +83,24 @@ PeCoffLoaderRelocateImageExtraAction (
   CHAR8 Temp[512];\r
 #endif\r
 \r
   CHAR8 Temp[512];\r
 #endif\r
 \r
+  if (ImageContext->PdbPointer) {\r
 #ifdef __CC_ARM\r
 #if (__ARMCC_VERSION < 500000)\r
 #ifdef __CC_ARM\r
 #if (__ARMCC_VERSION < 500000)\r
-  // Print out the command for the RVD debugger to load symbols for this image\r
-  DEBUG ((EFI_D_ERROR, "load /a /ni /np %a &0x%08x\n", DeCygwinPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)), (UINTN)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders)));\r
+    // Print out the command for the RVD debugger to load symbols for this image\r
+    DEBUG ((EFI_D_ERROR, "load /a /ni /np %a &0x%08x\n", DeCygwinPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)), (UINTN)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders)));\r
 #else\r
 #else\r
-  // Print out the command for the DS-5 to load symbols for this image\r
-  DEBUG ((EFI_D_ERROR, "add-symbol-file %a 0x%08x\n", DeCygwinPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)), (UINTN)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders)));\r
+    // Print out the command for the DS-5 to load symbols for this image\r
+    DEBUG ((EFI_D_ERROR, "add-symbol-file %a 0x%08x\n", DeCygwinPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)), (UINTN)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders)));\r
 #endif\r
 #elif __GNUC__\r
 #endif\r
 #elif __GNUC__\r
-  // This may not work correctly if you generate PE/COFF directlyas then the Offset would not be required\r
-  DEBUG ((EFI_D_ERROR, "add-symbol-file %a 0x%08x\n", DeCygwinPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)), (UINTN)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders)));\r
+    // This may not work correctly if you generate PE/COFF directlyas then the Offset would not be required\r
+    DEBUG ((EFI_D_ERROR, "add-symbol-file %a 0x%08x\n", DeCygwinPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)), (UINTN)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders)));\r
 #else\r
 #else\r
-  DEBUG ((EFI_D_ERROR, "Loading driver at 0x%11p EntryPoint=0x%11p\n", (VOID *)(UINTN) ImageContext->ImageAddress, FUNCTION_ENTRY_POINT (ImageContext->EntryPoint)));\r
+    DEBUG ((EFI_D_ERROR, "Loading driver at 0x%11p EntryPoint=0x%11p\n", (VOID *)(UINTN) ImageContext->ImageAddress, FUNCTION_ENTRY_POINT (ImageContext->EntryPoint)));\r
 #endif\r
 #endif\r
+  } else {\r
+    DEBUG ((EFI_D_ERROR, "Loading driver at 0x%11p EntryPoint=0x%11p\n", (VOID *)(UINTN) ImageContext->ImageAddress, FUNCTION_ENTRY_POINT (ImageContext->EntryPoint)));\r
+  }\r
 }\r
 \r
 \r
 }\r
 \r
 \r
@@ -121,15 +125,17 @@ PeCoffLoaderUnloadImageExtraAction (
   CHAR8 Temp[512];\r
 #endif\r
   \r
   CHAR8 Temp[512];\r
 #endif\r
   \r
+  if (ImageContext->PdbPointer) {\r
 #ifdef __CC_ARM\r
 #ifdef __CC_ARM\r
-  {  \r
-  // Print out the command for the RVD debugger to load symbols for this image\r
+    // Print out the command for the RVD debugger to load symbols for this image\r
     DEBUG ((EFI_D_ERROR, "unload symbols_only %a\n", DeCygwinPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp))));\r
     DEBUG ((EFI_D_ERROR, "unload symbols_only %a\n", DeCygwinPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp))));\r
-  }\r
 #elif __GNUC__\r
 #elif __GNUC__\r
-  // This may not work correctly if you generate PE/COFF directlyas then the Offset would not be required\r
-  DEBUG ((EFI_D_ERROR, "remove-symbol-file %a 0x%08x\n", DeCygwinPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)), (UINTN)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders)));\r
+    // This may not work correctly if you generate PE/COFF directlyas then the Offset would not be required\r
+    DEBUG ((EFI_D_ERROR, "remove-symbol-file %a 0x%08x\n", DeCygwinPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)), (UINTN)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders)));\r
 #else\r
 #else\r
-  DEBUG ((EFI_D_ERROR, "Unloading %a\n", ImageContext->PdbPointer));\r
+    DEBUG ((EFI_D_ERROR, "Unloading %a\n", ImageContext->PdbPointer));\r
 #endif\r
 #endif\r
+  } else {\r
+    DEBUG ((EFI_D_ERROR, "Unloading driver at 0x%11p\n", (VOID *)(UINTN) ImageContext->ImageAddress));\r
+  }\r
 }\r
 }\r