From: ajfish Date: Fri, 11 Aug 2006 18:08:43 +0000 (+0000) Subject: Fixed issue with new MAP file feature a fprintf was using a pointer to the .PDB file... X-Git-Tag: edk2-stable201903~24632 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=396974d645ad71a8e465491298b252df5cae3c38 Fixed issue with new MAP file feature a fprintf was using a pointer to the .PDB file that was in data that had been freed. Moved the fprint before the free and also print out if the image is PE32 or TE now in the map file. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1241 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/Tools/Source/TianoTools/PeiRebase/PeiRebaseExe.c b/Tools/Source/TianoTools/PeiRebase/PeiRebaseExe.c index cc07fa06bb..fac6ebe14d 100644 --- a/Tools/Source/TianoTools/PeiRebase/PeiRebaseExe.c +++ b/Tools/Source/TianoTools/PeiRebase/PeiRebaseExe.c @@ -706,6 +706,18 @@ Returns: memcpy (CurrentPe32Section.Pe32Section + 1, (VOID *) MemoryImagePointerAligned, (UINT32) ImageSize); + // + // If a map file was selected output mapping information for any file that + // was rebased. + // + if (MapFile != NULL) { + fprintf (MapFile, "PE32 File: %s Base:%08lx", FileGuidString, BaseAddress); + if (ImageContext.PdbPointer != NULL) { + fprintf (MapFile, " FileName: %s", ImageContext.PdbPointer); + } + fprintf (MapFile, "\n"); + } + free ((VOID *) MemoryImagePointer); // @@ -929,6 +941,19 @@ Returns: GetLength (CurrentPe32Section.Pe32Section->CommonHeader.Size) - sizeof (EFI_PE32_SECTION) - sizeof (EFI_TE_IMAGE_HEADER) ); + + // + // If a map file was selected output mapping information for any file that + // was rebased. + // + if (MapFile != NULL) { + fprintf (MapFile, "TE File: %s Base:%08lx", FileGuidString, BaseAddress); + if (ImageContext.PdbPointer != NULL) { + fprintf (MapFile, " FileName: %s", ImageContext.PdbPointer); + } + fprintf (MapFile, "\n"); + } + free ((VOID *) MemoryImagePointer); free (TEBuffer); if (FfsFile->Attributes & FFS_ATTRIB_TAIL_PRESENT) { @@ -972,18 +997,6 @@ Returns: return EFI_NOT_FOUND; } } - - // - // If a map file was selected output mapping information for any file that - // was rebased. - // - if (MapFile != NULL) { - fprintf (MapFile, "File: %s Base:%08lx", FileGuidString, BaseAddress); - if (ImageContext.PdbPointer != NULL) { - fprintf (MapFile, " FileName: %s", ImageContext.PdbPointer); - } - fprintf (MapFile, "\n"); - } return EFI_SUCCESS; }