From 28929e20d449b534c41ff1573f003062900a2a54 Mon Sep 17 00:00:00 2001 From: oliviermartin Date: Tue, 5 Mar 2013 23:01:53 +0000 Subject: [PATCH] ArmPkg/DebugPeCoffExtraActionLib: Checked the ImageContext->PdbPointer is not null This check prevents to get an assertion in case of null PdbPointer. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Leif Lindholm Signed-off-by: Olivier Martin git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14163 6f19259b-4bc3-4df7-8a09-765794883524 --- .../DebugPeCoffExtraActionLib.c | 32 +++++++++++-------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.c b/ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.c index 6459d51cff..6d0bb988ea 100755 --- a/ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.c +++ b/ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.c @@ -83,20 +83,24 @@ PeCoffLoaderRelocateImageExtraAction ( CHAR8 Temp[512]; #endif + if (ImageContext->PdbPointer) { #ifdef __CC_ARM #if (__ARMCC_VERSION < 500000) - // Print out the command for the RVD debugger to load symbols for this image - DEBUG ((EFI_D_ERROR, "load /a /ni /np %a &0x%08x\n", DeCygwinPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)), (UINTN)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders))); + // Print out the command for the RVD debugger to load symbols for this image + DEBUG ((EFI_D_ERROR, "load /a /ni /np %a &0x%08x\n", DeCygwinPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)), (UINTN)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders))); #else - // Print out the command for the DS-5 to load symbols for this image - DEBUG ((EFI_D_ERROR, "add-symbol-file %a 0x%08x\n", DeCygwinPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)), (UINTN)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders))); + // Print out the command for the DS-5 to load symbols for this image + DEBUG ((EFI_D_ERROR, "add-symbol-file %a 0x%08x\n", DeCygwinPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)), (UINTN)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders))); #endif #elif __GNUC__ - // This may not work correctly if you generate PE/COFF directlyas then the Offset would not be required - DEBUG ((EFI_D_ERROR, "add-symbol-file %a 0x%08x\n", DeCygwinPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)), (UINTN)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders))); + // This may not work correctly if you generate PE/COFF directlyas then the Offset would not be required + DEBUG ((EFI_D_ERROR, "add-symbol-file %a 0x%08x\n", DeCygwinPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)), (UINTN)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders))); #else - DEBUG ((EFI_D_ERROR, "Loading driver at 0x%11p EntryPoint=0x%11p\n", (VOID *)(UINTN) ImageContext->ImageAddress, FUNCTION_ENTRY_POINT (ImageContext->EntryPoint))); + DEBUG ((EFI_D_ERROR, "Loading driver at 0x%11p EntryPoint=0x%11p\n", (VOID *)(UINTN) ImageContext->ImageAddress, FUNCTION_ENTRY_POINT (ImageContext->EntryPoint))); #endif + } else { + DEBUG ((EFI_D_ERROR, "Loading driver at 0x%11p EntryPoint=0x%11p\n", (VOID *)(UINTN) ImageContext->ImageAddress, FUNCTION_ENTRY_POINT (ImageContext->EntryPoint))); + } } @@ -121,15 +125,17 @@ PeCoffLoaderUnloadImageExtraAction ( CHAR8 Temp[512]; #endif + if (ImageContext->PdbPointer) { #ifdef __CC_ARM - { - // Print out the command for the RVD debugger to load symbols for this image + // Print out the command for the RVD debugger to load symbols for this image DEBUG ((EFI_D_ERROR, "unload symbols_only %a\n", DeCygwinPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)))); - } #elif __GNUC__ - // This may not work correctly if you generate PE/COFF directlyas then the Offset would not be required - DEBUG ((EFI_D_ERROR, "remove-symbol-file %a 0x%08x\n", DeCygwinPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)), (UINTN)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders))); + // This may not work correctly if you generate PE/COFF directlyas then the Offset would not be required + DEBUG ((EFI_D_ERROR, "remove-symbol-file %a 0x%08x\n", DeCygwinPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)), (UINTN)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders))); #else - DEBUG ((EFI_D_ERROR, "Unloading %a\n", ImageContext->PdbPointer)); + DEBUG ((EFI_D_ERROR, "Unloading %a\n", ImageContext->PdbPointer)); #endif + } else { + DEBUG ((EFI_D_ERROR, "Unloading driver at 0x%11p\n", (VOID *)(UINTN) ImageContext->ImageAddress)); + } }