\r
PeHdr = NULL;\r
TeHdr = NULL;\r
+ OptionHeader.Header = NULL;\r
//\r
// Assume success\r
//\r
//\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
// 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
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