From 396974d645ad71a8e465491298b252df5cae3c38 Mon Sep 17 00:00:00 2001 From: ajfish Date: Fri, 11 Aug 2006 18:08:43 +0000 Subject: [PATCH] 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 --- .../TianoTools/PeiRebase/PeiRebaseExe.c | 37 +++++++++++++------ 1 file changed, 25 insertions(+), 12 deletions(-) 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; } -- 2.39.2