]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/C/Common/BasePeCoff.c
Sync basetools' source and binary files with r1707 of the basetools project.
[mirror_edk2.git] / BaseTools / Source / C / Common / BasePeCoff.c
index 72b6a52f890c162744b9f4bbbaf527598774c083..0166c22460fbc3ca5a05c9bc7f826d55e725e505 100644 (file)
@@ -856,6 +856,7 @@ Returns:
 \r
   PeHdr = NULL;\r
   TeHdr = NULL;\r
+  OptionHeader.Header = NULL;\r
   //\r
   // Assume success\r
   //\r
@@ -1252,11 +1253,11 @@ PeCoffLoaderGetPdbPointer (
       //\r
       // Get the DebugEntry offset in the raw data image.\r
       //\r
-           SectionHeader = (EFI_IMAGE_SECTION_HEADER *) (Hdr.Te + 1);\r
-           Index = Hdr.Te->NumberOfSections;\r
+      SectionHeader = (EFI_IMAGE_SECTION_HEADER *) (Hdr.Te + 1);\r
+      Index = Hdr.Te->NumberOfSections;\r
       for (Index1 = 0; Index1 < Index; Index1 ++) {\r
-       if ((DirectoryEntry->VirtualAddress >= SectionHeader[Index1].VirtualAddress) && \r
-                (DirectoryEntry->VirtualAddress < (SectionHeader[Index1].VirtualAddress + SectionHeader[Index1].Misc.VirtualSize))) {\r
+        if ((DirectoryEntry->VirtualAddress >= SectionHeader[Index1].VirtualAddress) && \r
+           (DirectoryEntry->VirtualAddress < (SectionHeader[Index1].VirtualAddress + SectionHeader[Index1].Misc.VirtualSize))) {\r
           DebugEntry = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *)((UINTN) Hdr.Te +\r
                         DirectoryEntry->VirtualAddress - \r
                         SectionHeader [Index1].VirtualAddress + \r
@@ -1324,8 +1325,8 @@ PeCoffLoaderGetPdbPointer (
       // Get the DebugEntry offset in the raw data image.\r
       //\r
       for (Index1 = 0; Index1 < Index; Index1 ++) {\r
-       if ((DirectoryEntry->VirtualAddress >= SectionHeader[Index1].VirtualAddress) && \r
-                (DirectoryEntry->VirtualAddress < (SectionHeader[Index1].VirtualAddress + SectionHeader[Index1].Misc.VirtualSize))) {\r
+        if ((DirectoryEntry->VirtualAddress >= SectionHeader[Index1].VirtualAddress) && \r
+           (DirectoryEntry->VirtualAddress < (SectionHeader[Index1].VirtualAddress + SectionHeader[Index1].Misc.VirtualSize))) {\r
           DebugEntry = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *) (\r
                        (UINTN) Pe32Data + \r
                        DirectoryEntry->VirtualAddress - \r
@@ -1349,27 +1350,28 @@ PeCoffLoaderGetPdbPointer (
   for (DirCount = 0; DirCount < DirectoryEntry->Size; DirCount += sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY), DebugEntry++) {\r
     if (EFI_IMAGE_DEBUG_TYPE_CODEVIEW == DebugEntry->Type) {\r
       if (DebugEntry->SizeOfData > 0) {\r
-             //\r
-             // Get the DebugEntry offset in the raw data image.\r
-             //\r
-             for (Index1 = 0; Index1 < Index; Index1 ++) {\r
-               if ((DebugEntry->RVA >= SectionHeader[Index1].VirtualAddress) && \r
-                        (DebugEntry->RVA < (SectionHeader[Index1].VirtualAddress + SectionHeader[Index1].Misc.VirtualSize))) {\r
-                 CodeViewEntryPointer = (VOID *) (\r
-                                        ((UINTN)Pe32Data) + \r
-                                        (UINTN) DebugEntry->RVA - \r
-                                        SectionHeader[Index1].VirtualAddress + \r
-                                        SectionHeader[Index1].PointerToRawData + \r
-                                        (UINTN)TEImageAdjust);\r
-                 break;\r
-               }\r
-             }\r
-             if (Index1 >= Index) {\r
-               //\r
-               // Can't find CodeViewEntryPointer in raw PE/COFF image.\r
-               //\r
-               continue;\r
-             }\r
+        //\r
+        // Get the DebugEntry offset in the raw data image.\r
+        //\r
+        CodeViewEntryPointer = NULL;\r
+        for (Index1 = 0; Index1 < Index; Index1 ++) {\r
+          if ((DebugEntry->RVA >= SectionHeader[Index1].VirtualAddress) && \r
+             (DebugEntry->RVA < (SectionHeader[Index1].VirtualAddress + SectionHeader[Index1].Misc.VirtualSize))) {\r
+            CodeViewEntryPointer = (VOID *) (\r
+                                   ((UINTN)Pe32Data) + \r
+                                   (UINTN) DebugEntry->RVA - \r
+                                   SectionHeader[Index1].VirtualAddress + \r
+                                   SectionHeader[Index1].PointerToRawData + \r
+                                   (UINTN)TEImageAdjust);\r
+            break;\r
+          }\r
+        }\r
+        if (Index1 >= Index) {\r
+          //\r
+          // Can't find CodeViewEntryPointer in raw PE/COFF image.\r
+          //\r
+          continue;\r
+        }\r
         switch (* (UINT32 *) CodeViewEntryPointer) {\r
         case CODEVIEW_SIGNATURE_NB10:\r
           return (VOID *) ((CHAR8 *)CodeViewEntryPointer + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY));\r