30 IN EFI_DEBUGGER_SYMBOL_TYPE Type
38 if (Object->EntryCount >= Object->MaxEntryCount) {
43 return EFI_OUT_OF_RESOURCES;
46 Entry = &Object->Entry[Object->EntryCount];
51 if (
sizeof (
UINTN) ==
sizeof (UINT64)) {
52 DEBUG ((DEBUG_ERROR,
" Symbol: %a, Address: 0x%016lx (%d)\n", Name, (UINT64)Address, (
UINTN)Type));
54 DEBUG ((DEBUG_ERROR,
" Symbol: %a, Address: 0x%08x (%d)\n", Name, Address, (
UINTN)Type));
60 AsciiStrnCpyS (Entry->Name, sizeof (Entry->Name), Name, sizeof (Entry->Name) - 1);
61 if (ObjName !=
NULL) {
62 AsciiStrnCpyS (Entry->ObjName, sizeof (Entry->ObjName), ObjName, sizeof (Entry->ObjName) - 1);
65 Entry->Rva = Address % EFI_DEBUGGER_DEFAULT_LINK_IMAGEBASE;
80 EdbEbcMapParseStateUninitialized,
81 EdbEbcMapParseStateSymbolStart,
82 EdbEbcMapParseStateSeHandlerSymbol,
83 EdbEbcMapParseStateFunctionSymbol,
84 EdbEbcMapParseStateVarbssInitSymbol,
85 EdbEbcMapParseStateCrtSymbol,
86 EdbEbcMapParseStateVariableSymbol,
87 EdbEbcMapParseStateStaticFunctionSymbol,
88 EdbEbcMapParseStateMax,
89} EDB_EBC_MAP_PARSE_STATE;
92 EdbEbcSymbolParseStateUninitialized,
93 EdbEbcSymbolParseStateReadyForName,
94 EdbEbcSymbolParseStateReadyForRVA,
95 EdbEbcSymbolParseStateReadyForType,
96 EdbEbcSymbolParseStateReadyForObject,
97 EdbEbcSymbolParseStateMax,
98} EDB_EBC_SYMBOL_PARSE_STATE;
173 EDB_EBC_MAP_PARSE_STATE MapParseState;
174 EDB_EBC_SYMBOL_PARSE_STATE SymbolParseState;
178 EFI_DEBUGGER_SYMBOL_TYPE Type;
184 MapParseState = EdbEbcMapParseStateUninitialized;
188 while (LineBuffer !=
NULL) {
190 SymbolParseState = EdbEbcSymbolParseStateUninitialized;
197 Type = EfiDebuggerSymbolTypeMax;
201 while (FieldBuffer !=
NULL) {
211 MapParseState = EdbEbcMapParseStateSymbolStart;
219 MapParseState = EdbEbcMapParseStateStaticFunctionSymbol;
223 if (MapParseState == EdbEbcMapParseStateUninitialized) {
240 switch (SymbolParseState) {
241 case EdbEbcSymbolParseStateUninitialized:
245 SymbolParseState = EdbEbcSymbolParseStateReadyForName;
247 case EdbEbcSymbolParseStateReadyForName:
255 MapParseState = EdbEbcMapParseStateSeHandlerSymbol;
261 MapParseState = EdbEbcMapParseStateVarbssInitSymbol;
264 SymbolParseState = EdbEbcSymbolParseStateReadyForRVA;
269 MapParseState = EdbEbcMapParseStateCrtSymbol;
272 SymbolParseState = EdbEbcSymbolParseStateReadyForRVA;
277 switch (MapParseState) {
278 case EdbEbcMapParseStateSeHandlerSymbol:
279 MapParseState = EdbEbcMapParseStateFunctionSymbol;
281 case EdbEbcMapParseStateCrtSymbol:
282 MapParseState = EdbEbcMapParseStateVariableSymbol;
284 case EdbEbcMapParseStateFunctionSymbol:
285 case EdbEbcMapParseStateVariableSymbol:
286 case EdbEbcMapParseStateStaticFunctionSymbol:
294 SymbolParseState = EdbEbcSymbolParseStateReadyForRVA;
298 case EdbEbcSymbolParseStateReadyForRVA:
303 SymbolParseState = EdbEbcSymbolParseStateReadyForType;
305 case EdbEbcSymbolParseStateReadyForType:
310 SymbolParseState = EdbEbcSymbolParseStateReadyForObject;
311 switch (MapParseState) {
312 case EdbEbcMapParseStateFunctionSymbol:
313 case EdbEbcMapParseStateVarbssInitSymbol:
314 Type = EfiDebuggerSymbolFunction;
316 case EdbEbcMapParseStateStaticFunctionSymbol:
317 Type = EfiDebuggerSymbolStaticFunction;
331 case EdbEbcSymbolParseStateReadyForObject:
333 case EfiDebuggerSymbolTypeMax:
334 switch (MapParseState) {
335 case EdbEbcMapParseStateVariableSymbol:
336 case EdbEbcMapParseStateCrtSymbol:
337 Type = EfiDebuggerSymbolGlobalVariable;
339 case EdbEbcMapParseStateSeHandlerSymbol:
350 case EfiDebuggerSymbolFunction:
351 case EfiDebuggerSymbolStaticFunction:
361 ObjName = FieldBuffer;
362 SymbolParseState = EdbEbcSymbolParseStateUninitialized;
378 if ((Name !=
NULL) && (Type != EfiDebuggerSymbolTypeMax)) {
445 for (ObjectIndex = 0; ObjectIndex < DebuggerPrivate->DebuggerSymbolContext.ObjectCount; ObjectIndex++) {
446 if (
StrCmp (FileName, DebuggerPrivate->DebuggerSymbolContext.Object[ObjectIndex].Name) == 0) {
451 *Index = ObjectIndex;
454 return &DebuggerPrivate->DebuggerSymbolContext.Object[ObjectIndex];
479 IN EDB_MATCH_SYMBOL_TYPE Type,
486 UINTN CandidateLowerAddress;
487 UINTN CandidateUpperAddress;
495 if ((Type < 0) || (Type >= EdbMatchSymbolTypeMax)) {
502 CandidateLowerAddress = 0;
503 CandidateUpperAddress = (
UINTN)-1;
512 Object = mDebuggerPrivate.DebuggerSymbolContext.Object;
513 for (Index = 0; Index < mDebuggerPrivate.DebuggerSymbolContext.ObjectCount; Index++, Object++) {
514 if (Object->EntryCount == 0) {
521 Entry = Object->Entry;
522 for (SubIndex = 0; SubIndex < Object->EntryCount; SubIndex++, Entry++) {
523 if (Address != Entry->Rva + Object->BaseAddress) {
527 if (Address > Entry->Rva + Object->BaseAddress) {
531 if (CandidateLowerAddress < Entry->Rva + Object->BaseAddress) {
532 CandidateLowerAddress = Entry->Rva + Object->BaseAddress;
540 if (CandidateUpperAddress > Entry->Rva + Object->BaseAddress) {
541 CandidateUpperAddress = Entry->Rva + Object->BaseAddress;
543 UpperObject = Object;
563 if ((Address - CandidateLowerAddress) < EFI_DEBUGGER_MAX_SYMBOL_ADDRESS_DELTA_VALUE) {
567 if (((Type == EdbMatchSymbolTypeNearestAddress) &&
568 ((CandidateUpperAddress - Address) > (Address - CandidateLowerAddress))) ||
569 (Type == EdbMatchSymbolTypeLowerAddress))
574 *RetEntry = LowEntry;
575 *RetObject = LowObject;
576 return CandidateLowerAddress;
580 if ((CandidateUpperAddress - Address) < EFI_DEBUGGER_MAX_SYMBOL_ADDRESS_DELTA_VALUE) {
584 if (((Type == EdbMatchSymbolTypeNearestAddress) &&
585 ((CandidateUpperAddress - Address) < (Address - CandidateLowerAddress))) ||
586 (Type == EdbMatchSymbolTypeUpperAddress))
591 *RetEntry = UpperEntry;
592 *RetObject = UpperObject;
593 return CandidateUpperAddress;
625 VOID **OldSourceBuffer;
631 if (Object ==
NULL) {
632 EDBPrint (L
"SymbolFile is not loaded!\n");
633 return EFI_DEBUG_CONTINUE;
639 Object = DebuggerPrivate->DebuggerSymbolContext.Object;
640 OldEntry = Object->Entry;
641 OldSourceBuffer = Object->SourceBuffer;
642 MaxEntryCount = Object->MaxEntryCount;
643 OldEntryCount = Object->EntryCount;
648 for (Index = ObjectIndex; Index < DebuggerPrivate->DebuggerSymbolContext.ObjectCount - 1; Index++) {
652 ZeroMem (&Object[Index],
sizeof (Object[Index]));
657 Object[Index].Entry = OldEntry;
658 Object[Index].SourceBuffer = OldSourceBuffer;
659 Object[Index].MaxEntryCount = MaxEntryCount;
660 DebuggerPrivate->DebuggerSymbolContext.ObjectCount--;
665 for (Index = 0; Index < OldEntryCount; Index++) {
666 ZeroMem (&OldEntry[Index],
sizeof (OldEntry[Index]));
672 for (Index = 0; OldSourceBuffer[Index] !=
NULL; Index++) {
673 gBS->FreePool (OldSourceBuffer[Index]);
674 OldSourceBuffer[Index] =
NULL;
707 if (Object !=
NULL) {
709 if (EFI_ERROR (Status)) {
710 DEBUG ((DEBUG_ERROR,
"Unload Duplicated Symbol File Error!\n"));
718 if (DebuggerPrivate->DebuggerSymbolContext.ObjectCount >= DebuggerPrivate->DebuggerSymbolContext.MaxObjectCount) {
723 return EFI_OUT_OF_RESOURCES;
726 Object = &DebuggerPrivate->DebuggerSymbolContext.Object[DebuggerPrivate->DebuggerSymbolContext.ObjectCount];
731 Object->EntryCount = 0;
732 Object->MaxEntryCount = EFI_DEBUGGER_SYMBOL_ENTRY_MAX;
737 DEBUG ((DEBUG_ERROR,
"Symbol File: %s\n", FileName));
739 if (EFI_ERROR (Status)) {
748 sizeof (Object->Name) / sizeof (CHAR16),
750 (
sizeof (Object->Name) / sizeof (CHAR16)) - 1
752 Object->BaseAddress = 0;
757 DebuggerPrivate->DebuggerSymbolContext.ObjectCount++;
785 VOID *CodeViewEntryPointer;
790 CodeViewEntryPointer =
NULL;
797 if (DosHdr->
e_magic != EFI_IMAGE_DOS_SIGNATURE) {
817 OptionalHdr32 = (VOID *)&NtHdr->Pe32.OptionalHeader;
820 OptionalHdr64 = (VOID *)&NtHdr->Pe32Plus.OptionalHeader;
826 if (DirectoryEntry->VirtualAddress == 0) {
843 CodeViewEntryPointer = (VOID *)((
UINTN)DebugEntry->
RVA + (
UINTN)ImageBase);
844 switch (*(UINT32 *)CodeViewEntryPointer) {
876 IN CHAR8 *PdbFileName,
877 IN CHAR16 *MapFileName
882 CHAR8 *PurePdbFileName;
888 PurePdbFileName = PdbFileName;
889 for (Index = 0; PdbFileName[Index] != 0; Index++) {
890 if (PdbFileName[Index] ==
'\\') {
891 PurePdbFileName = &PdbFileName[Index + 1];
895 PdbFileName = PurePdbFileName;
901 MapNameSize =
StrLen (MapFileName);
903 if (PdbNameSize != MapNameSize) {
910 for (Index = 0; Index < MapNameSize - 4; Index++) {
911 if ((PdbFileName[Index] | 0x20) != (MapFileName[Index] | 0x20)) {
924 volatile UINT32 UpdateStatus;
967 if ((*DebugImageInfoTableHeader)->UpdateStatus > 3) {
968 *DebugImageInfoTableHeader = &mDebugImageInfoTableHeader;
972 if ((*DebugImageInfoTableHeader)->TableSize % (EFI_PAGE_SIZE / (sizeof (VOID *))) != 0) {
973 *DebugImageInfoTableHeader = &mDebugImageInfoTableHeader;
1000 IN EDB_EBC_IMAGE_RVA_SEARCH_TYPE SearchType
1008 VOID *CandidateImageBase;
1011 if ((SearchType < 0) || (SearchType >= EdbEbcImageRvaSearchTypeMax)) {
1012 return EFI_INVALID_PARAMETER;
1019 if (Object ==
NULL) {
1020 return EFI_NOT_FOUND;
1026 if (mDebuggerPrivate.DebugImageInfoTableHeader ==
NULL) {
1028 &gEfiDebugImageInfoTableGuid,
1029 (VOID **)&mDebuggerPrivate.DebugImageInfoTableHeader
1031 if (EFI_ERROR (Status)) {
1032 EDBPrint (L
"DebugImageInfoTable not found!\n");
1037 DEBUG ((DEBUG_ERROR,
"DebugImageInfoTableHeader: %x\n", mDebuggerPrivate.DebugImageInfoTableHeader));
1050 CandidateImageBase =
NULL;
1052 for (ImageNumber = 0; ImageNumber < mDebuggerPrivate.DebugImageInfoTableHeader->
TableSize; ImageNumber++) {
1053 if (ImageTable[ImageNumber].NormalImage ==
NULL) {
1062 if (PdbPath ==
NULL) {
1073 DEBUG ((DEBUG_ERROR,
"ImageBase: %x\n", ImageBase));
1078 if ((SearchType == EdbEbcImageRvaSearchTypeAny) || (SearchType == EdbEbcImageRvaSearchTypeFirst)) {
1082 Object->BaseAddress = (
UINTN)ImageBase;
1089 CandidateImageBase = ImageBase;
1095 if (SearchType == EdbEbcImageRvaSearchTypeLast) {
1096 if (CandidateImageBase ==
NULL) {
1097 return EFI_NOT_FOUND;
1103 Object->BaseAddress = (
UINTN)CandidateImageBase;
1110 return EFI_NOT_FOUND;
1126 IN CHAR8 *ObjFileName,
1127 IN CHAR16 *CodFileName
1132 CHAR8 *PureObjFileName;
1138 PureObjFileName = ObjFileName;
1139 for (Index = 0; ObjFileName[Index] != 0; Index++) {
1140 if (ObjFileName[Index] ==
':') {
1141 PureObjFileName = &ObjFileName[Index + 1];
1146 ObjFileName = PureObjFileName;
1152 CodNameSize =
StrLen (CodFileName);
1154 if (ObjNameSize != CodNameSize) {
1161 for (Index = 0; Index < CodNameSize - 4; Index++) {
1162 if ((ObjFileName[Index] | 0x20) != (CodFileName[Index] | 0x20)) {
1171 EdbEbcCodParseStateUninitialized,
1172 EdbEbcCodParseStateSymbolInitialized,
1173 EdbEbcCodParseStateSymbolStart,
1174 EdbEbcCodParseStateSymbolEnd,
1175 EdbEbcCodParseStateMax,
1176} EDB_EBC_COD_PARSE_STATE;
1211 EDB_EBC_COD_PARSE_STATE CodParseState;
1223 CodParseState = EdbEbcCodParseStateUninitialized;
1228 while (LineBuffer !=
NULL) {
1229 switch (CodParseState) {
1230 case EdbEbcCodParseStateUninitialized:
1234 if (
AsciiStrCmp (LineBuffer,
"; mark_begin;") == 0) {
1235 CodParseState = EdbEbcCodParseStateSymbolInitialized;
1242 case EdbEbcCodParseStateSymbolInitialized:
1246 if (
AsciiStrCmp (LineBuffer,
"; mark_end;") == 0) {
1247 CodParseState = EdbEbcCodParseStateUninitialized;
1256 if ((*LineBuffer == 0) ||
1257 (*LineBuffer ==
'$') ||
1258 (*LineBuffer ==
';') ||
1259 (*LineBuffer ==
'_') ||
1260 (*LineBuffer ==
' '))
1271 ASSERT (FieldBuffer !=
NULL);
1273 BufferStart = FieldBuffer;
1274 CodParseState = EdbEbcCodParseStateSymbolStart;
1286 case EdbEbcCodParseStateSymbolStart:
1290 if (
AsciiStrCmp (LineBuffer,
"; mark_end;") == 0) {
1291 CodParseState = EdbEbcCodParseStateSymbolEnd;
1295 BufferEnd = LineBuffer +
sizeof (
"; mark_end;") - 1;
1296 *CodeBufferSize = (
UINTN)BufferEnd - (
UINTN)BufferStart;
1297 *FuncOffset = Offset;
1305 if ((Offset == (
UINTN)-1) &&
1306 (*LineBuffer ==
' '))
1320 case EdbEbcCodParseStateSymbolEnd:
1386 for (EntryIndex = 0; EntryIndex < Object->EntryCount; EntryIndex++) {
1390 if ((Object->Entry[EntryIndex].Type != EfiDebuggerSymbolFunction) &&
1391 (Object->Entry[EntryIndex].Type != EfiDebuggerSymbolStaticFunction))
1399 if (
AsciiStrnCmp (Object->Entry[EntryIndex].Name,
"varbss_init", sizeof (
"varbss_init") - 1) == 0) {
1406 if (!
MatchObjAndCod (Object->Entry[EntryIndex].ObjName, FileName)) {
1413 if (Object->Entry[EntryIndex].CodBuffer !=
NULL) {
1414 return Object->Entry[EntryIndex].SourceBuffer;
1440 IN CHAR16 *MapFileName,
1441 IN CHAR16 *FileName,
1456 if (Object ==
NULL) {
1457 EDBPrint (L
"SymbolFile is not loaded!\n");
1458 return EFI_NOT_FOUND;
1464 if (SourceBuffer !=
NULL) {
1468 Status =
EdbUnloadCode (DebuggerPrivate, MapFileName, FileName, &SourceBuffer);
1469 if (EFI_ERROR (Status)) {
1470 DEBUG ((DEBUG_ERROR,
"Unload Duplicated Code File Error!\n"));
1475 if (EFI_ERROR (Status)) {
1476 DEBUG ((DEBUG_ERROR,
"Delete Duplicated Code File Error!\n"));
1485 for (EntryIndex = 0; EntryIndex < Object->EntryCount; EntryIndex++) {
1489 if ((Object->Entry[EntryIndex].Type != EfiDebuggerSymbolFunction) &&
1490 (Object->Entry[EntryIndex].Type != EfiDebuggerSymbolStaticFunction))
1498 if (
AsciiStrnCmp (Object->Entry[EntryIndex].Name,
"varbss_init", sizeof (
"varbss_init") - 1) == 0) {
1505 if (!
MatchObjAndCod (Object->Entry[EntryIndex].ObjName, FileName)) {
1513 Object->Entry[EntryIndex].Name,
1516 &Object->Entry[EntryIndex].CodBufferSize,
1517 &Object->Entry[EntryIndex].FuncOffsetBase
1519 if (Object->Entry[EntryIndex].CodBuffer !=
NULL) {
1520 Object->Entry[EntryIndex].SourceBuffer = Buffer;
1527 for (EntryIndex = 0; EntryIndex < Object->EntryCount; EntryIndex++) {
1528 if (Object->Entry[EntryIndex].CodBuffer !=
NULL) {
1529 *((UINT8 *)Object->Entry[EntryIndex].CodBuffer + Object->Entry[EntryIndex].CodBufferSize) = 0;
1530 DEBUG ((DEBUG_ERROR,
" CodeSymbol: %a, FuncOffset: 0x05%x\n", Object->Entry[EntryIndex].Name, Object->Entry[EntryIndex].FuncOffsetBase));
1556 IN CHAR16 *MapFileName,
1557 IN CHAR16 *FileName,
1569 if (Object ==
NULL) {
1570 EDBPrint (L
"SymbolFile is not loaded!\n");
1571 return EFI_NOT_FOUND;
1578 if (*Buffer ==
NULL) {
1579 EDBPrint (L
"CodeFile is not loaded!\n");
1580 return EFI_NOT_FOUND;
1586 for (EntryIndex = 0; EntryIndex < Object->EntryCount; EntryIndex++) {
1587 if ((Object->Entry[EntryIndex].Type != EfiDebuggerSymbolFunction) &&
1588 (Object->Entry[EntryIndex].Type != EfiDebuggerSymbolStaticFunction))
1593 if (
AsciiStrnCmp (Object->Entry[EntryIndex].Name,
"varbss_init", sizeof (
"varbss_init") - 1) == 0) {
1597 if (!
MatchObjAndCod (Object->Entry[EntryIndex].ObjName, FileName)) {
1604 Object->Entry[EntryIndex].CodBuffer =
NULL;
1605 Object->Entry[EntryIndex].CodBufferSize = 0;
1606 Object->Entry[EntryIndex].FuncOffsetBase = 0;
1607 Object->Entry[EntryIndex].SourceBuffer =
NULL;
1632 IN CHAR16 *MapFileName,
1633 IN CHAR16 *CodeFileName,
1635 IN VOID *SourceBuffer
1645 if (Object ==
NULL) {
1646 EDBPrint (L
"SymbolFile is not loaded!\n");
1647 return EFI_NOT_FOUND;
1653 for (Index = 0; Object->SourceBuffer[Index] !=
NULL; Index++) {
1656 Object->SourceBuffer[Index] = SourceBuffer;
1676 IN CHAR16 *MapFileName,
1677 IN CHAR16 *CodeFileName,
1678 IN VOID *SourceBuffer
1688 if (Object ==
NULL) {
1689 EDBPrint (L
"SymbolFile is not loaded!\n");
1690 return EFI_NOT_FOUND;
1693 for (Index = 0; Object->SourceBuffer[Index] !=
NULL; Index++) {
1697 if (Object->SourceBuffer[Index] == SourceBuffer) {
1698 gBS->FreePool (SourceBuffer);
1703 if (Object->SourceBuffer[Index] ==
NULL) {
1713 Object->SourceBuffer[Index] =
NULL;
1714 for (Index = Index + 1; Object->SourceBuffer[Index] !=
NULL; Index++) {
1715 Object->SourceBuffer[Index - 1] = Object->SourceBuffer[Index];
1718 Object->SourceBuffer[Index - 1] =
NULL;
1745 if (!mDebuggerPrivate.DebuggerSymbolContext.DisplaySymbol) {
1752 Object = mDebuggerPrivate.DebuggerSymbolContext.Object;
1753 for (ObjectIndex = 0; ObjectIndex < mDebuggerPrivate.DebuggerSymbolContext.ObjectCount; ObjectIndex++) {
1754 Entry = Object[ObjectIndex].Entry;
1755 for (EntryIndex = 0; EntryIndex < Object[ObjectIndex].EntryCount; EntryIndex++) {
1759 if (Address == (Entry[EntryIndex].Rva + Object[ObjectIndex].BaseAddress)) {
1760 return Entry[EntryIndex].Name;
1791 LineNumber = (
UINTN)-1;
1793 *Offset = (
UINTN)-1;
1795 while (LineBuffer !=
NULL) {
1799 if (*LineBuffer !=
' ') {
1806 if (*(LineBuffer + 2) !=
' ') {
1807 if (*Offset == (
UINTN)-1) {
1823 if (FieldBuffer ==
NULL) {
1838 if (FieldBuffer ==
NULL) {
1859 EdbEbcLineSearchTypeAny,
1860 EdbEbcLineSearchTypeFirst,
1861 EdbEbcLineSearchTypeLast,
1862 EdbEbcLineSearchTypeMax,
1863} EDB_EBC_LINE_SEARCH_TYPE;
1880 IN EDB_EBC_LINE_SEARCH_TYPE SearchType
1886 UINTN CandidateLineNumber;
1887 UINTN CandidateOffset;
1889 if ((SearchType < 0) || (SearchType >= EdbEbcLineSearchTypeMax)) {
1893 LineNumber = (
UINTN)-1;
1894 CandidateLineNumber = (
UINTN)-1;
1895 CandidateOffset = (
UINTN)-1;
1897 while (LineBuffer !=
NULL) {
1898 if (*LineBuffer !=
' ') {
1912 if (Offset != FuncOffset) {
1916 if (CandidateOffset == FuncOffset) {
1917 if (SearchType == EdbEbcLineSearchTypeLast) {
1919 if (CandidateLineNumber != LineNumber) {
1920 return CandidateLineNumber;
1933 CandidateLineNumber = LineNumber;
1940 if (SearchType == EdbEbcLineSearchTypeAny) {
1945 if (SearchType == EdbEbcLineSearchTypeFirst) {
1950 if (CandidateLineNumber != LineNumber) {
1957 CandidateLineNumber = LineNumber;
1958 CandidateOffset = Offset;
1967 if (CandidateOffset == FuncOffset) {
1968 if (SearchType == EdbEbcLineSearchTypeLast) {
1969 return CandidateLineNumber;
2001 while (LineBuffer !=
NULL) {
2002 if (*LineBuffer !=
';') {
2003 if (FuncStart !=
NULL) {
2007 *FuncEnd = LineBuffer - 1;
2023 if (Number != LineNumber) {
2032 if (FuncStart ==
NULL) {
2033 FuncStart = LineBuffer;
2067 if (LineNumber == (
UINTN)-1) {
2091 UINTN SymbolAddress;
2098 CHAR8 Buffer[EFI_DEBUG_MAX_PRINT_BUFFER];
2104 if (!mDebuggerPrivate.DebuggerSymbolContext.DisplaySymbol) {
2113 EdbMatchSymbolTypeLowerAddress,
2117 if ((SymbolAddress == 0) || (RetEntry ==
NULL)) {
2121 FuncOffset = Address - SymbolAddress + RetEntry->FuncOffsetBase;
2127 if (FuncStart ==
NULL) {
2138 *(UINT8 *)FuncEnd = 0;
2143 FuncIndex = FuncStart;
2144 while (*FuncIndex != 0) {
2145 if (*FuncIndex ==
'\n') {
2146 if ((FuncIndex - FuncStart) < (EFI_DEBUG_MAX_PRINT_BUFFER - 3)) {
2147 BufferSize = FuncIndex - FuncStart;
2149 BufferSize = EFI_DEBUG_MAX_PRINT_BUFFER - 3;
2152 if (BufferSize != 0) {
2153 CopyMem (Buffer, FuncStart, BufferSize);
2156 Buffer[BufferSize] = 0;
2158 FuncStart = FuncIndex + 1;
2159 FuncIndex = FuncStart;
2168 *(UINT8 *)FuncEnd =
'\n';
2185 OUT CHAR16 **MapfileName,
2186 OUT CHAR16 **SymbolName
2191 *MapfileName =
NULL;
2192 *SymbolName = Symbol;
2194 for (Ch = Symbol; *Ch != 0; Ch++) {
2199 *MapfileName = Symbol;
2201 *SymbolName = Ch + 1;
2232 CHAR16 *MapfileName;
2243 Object = mDebuggerPrivate.DebuggerSymbolContext.Object;
2244 for (ObjectIndex = 0; ObjectIndex < mDebuggerPrivate.DebuggerSymbolContext.ObjectCount; ObjectIndex++) {
2248 if ((MapfileName !=
NULL) && (
StriCmp (Object[ObjectIndex].Name, MapfileName) != 0)) {
2255 Entry = Object[ObjectIndex].Entry;
2256 for (EntryIndex = 0; EntryIndex < Object[ObjectIndex].EntryCount; EntryIndex++) {
2261 if ((*Address != 0) && (MapfileName ==
NULL)) {
2265 EDBPrint (L
"Duplicated Symbol found!\n");
2266 return EFI_NO_MAPPING;
2271 *Address = (Entry[EntryIndex].Rva + Object[ObjectIndex].BaseAddress);
2277 if (*Address == 0) {
2281 return EFI_NOT_FOUND;
INTN EFIAPI AsciiStriCmp(IN CONST CHAR8 *FirstString, IN CONST CHAR8 *SecondString)
RETURN_STATUS EFIAPI AsciiStrnCpyS(OUT CHAR8 *Destination, IN UINTN DestMax, IN CONST CHAR8 *Source, IN UINTN Length)
INTN EFIAPI StrCmp(IN CONST CHAR16 *FirstString, IN CONST CHAR16 *SecondString)
UINTN EFIAPI AsciiStrLen(IN CONST CHAR8 *String)
INTN EFIAPI AsciiStrCmp(IN CONST CHAR8 *FirstString, IN CONST CHAR8 *SecondString)
INTN EFIAPI AsciiStrnCmp(IN CONST CHAR8 *FirstString, IN CONST CHAR8 *SecondString, IN UINTN Length)
RETURN_STATUS EFIAPI StrnCpyS(OUT CHAR16 *Destination, IN UINTN DestMax, IN CONST CHAR16 *Source, IN UINTN Length)
UINTN EFIAPI StrLen(IN CONST CHAR16 *String)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
VOID EFIAPI PatchForAsciiStrTokenAfter(IN CHAR8 *Buffer, IN CHAR8 Patch)
CHAR8 *EFIAPI AsciiStrGetNewTokenLine(IN CHAR8 *String, IN CHAR8 *CharSet)
UINTN EFIAPI AsciiAtoi(CHAR8 *Str)
VOID EFIAPI PatchForAsciiStrTokenBefore(IN CHAR8 *Buffer, IN CHAR8 Patch)
UINTN EFIAPI EDBPrint(IN CONST CHAR16 *Format,...)
UINTN EFIAPI AsciiXtoi(CHAR8 *Str)
INTN EFIAPI StrCmpUnicodeAndAscii(IN CHAR16 *String, IN CHAR8 *String2)
CHAR8 *EFIAPI AsciiStrGetNextTokenLine(IN CHAR8 *CharSet)
CHAR8 *EFIAPI AsciiStrGetNextTokenField(IN CHAR8 *CharSet)
CHAR8 *EFIAPI AsciiStrGetNewTokenField(IN CHAR8 *String, IN CHAR8 *CharSet)
INTN EFIAPI StriCmp(IN CHAR16 *String, IN CHAR16 *String2)
EFI_STATUS EdbLoadSymbol(IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate, IN CHAR16 *FileName, IN UINTN BufferSize, IN VOID *Buffer)
VOID * EdbFindCodeFromObject(IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate, IN EFI_DEBUGGER_SYMBOL_OBJECT *Object, IN CHAR16 *FileName)
VOID EdbFixDebugImageInfoTable(IN OUT EFI_DEBUG_IMAGE_INFO_TABLE_HEADER **DebugImageInfoTableHeader)
EFI_STATUS EdbLoadCode(IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate, IN CHAR16 *MapFileName, IN CHAR16 *FileName, IN UINTN BufferSize, IN VOID *Buffer)
EFI_STATUS EdbLoadSymbolEntry(IN EFI_DEBUGGER_SYMBOL_OBJECT *Object, IN UINTN BufferSize, IN VOID *Buffer)
EFI_STATUS EdbUnloadSymbol(IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate, IN CHAR16 *FileName)
VOID * EdbGetSourceStrFromCodeByLine(IN EFI_DEBUGGER_SYMBOL_ENTRY *Entry, IN UINTN LineNumber, IN VOID **FuncEnd)
EFI_STATUS EdbLoadSymbolEntryByIec(IN EFI_DEBUGGER_SYMBOL_OBJECT *Object, IN UINTN BufferSize, IN VOID *Buffer)
UINTN EdbGetLineNumberFromCode(IN EFI_DEBUGGER_SYMBOL_ENTRY *Entry, IN UINTN FuncOffset, IN EDB_EBC_LINE_SEARCH_TYPE SearchType)
CHAR8 * EdbLoadCodBySymbol(IN CHAR8 *Name, IN VOID *Buffer, IN UINTN BufferSize, OUT UINTN *CodeBufferSize, OUT UINTN *FuncOffset)
BOOLEAN MatchPdbAndMap(IN CHAR8 *PdbFileName, IN CHAR16 *MapFileName)
CHAR8 * EdbLoadCodBySymbolByIec(IN CHAR8 *Name, IN VOID *Buffer, IN UINTN BufferSize, OUT UINTN *CodeBufferSize, OUT UINTN *FuncOffset)
UINTN EdbPrintSource(IN UINTN Address, IN BOOLEAN IsPrint)
VOID * EdbGetSourceStrFromCode(IN EFI_DEBUGGER_SYMBOL_ENTRY *Entry, IN UINTN FuncOffset, IN VOID **FuncEnd)
CHAR8 * GetPdbPath(VOID *ImageBase)
EFI_STATUS EdbAddCodeBuffer(IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate, IN CHAR16 *MapFileName, IN CHAR16 *CodeFileName, IN UINTN SourceBufferSize, IN VOID *SourceBuffer)
EFI_STATUS EdbLoadSymbolSingleEntry(IN EFI_DEBUGGER_SYMBOL_OBJECT *Object, IN CHAR8 *Name, IN CHAR8 *ObjName, IN UINTN Address, IN EFI_DEBUGGER_SYMBOL_TYPE Type)
UINTN EdbGetLineNumberAndOffsetFromThisLine(IN VOID *Line, OUT UINTN *Offset)
EFI_STATUS EdbUnloadCode(IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate, IN CHAR16 *MapFileName, IN CHAR16 *FileName, OUT VOID **Buffer)
EFI_STATUS Symboltoi(IN CHAR16 *Symbol, OUT UINTN *Address)
EFI_STATUS EdbPatchSymbolRVA(IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate, IN CHAR16 *FileName, IN EDB_EBC_IMAGE_RVA_SEARCH_TYPE SearchType)
BOOLEAN MatchObjAndCod(IN CHAR8 *ObjFileName, IN CHAR16 *CodFileName)
UINTN EbdFindSymbolAddress(IN UINTN Address, IN EDB_MATCH_SYMBOL_TYPE Type, OUT EFI_DEBUGGER_SYMBOL_OBJECT **RetObject, OUT EFI_DEBUGGER_SYMBOL_ENTRY **RetEntry)
VOID GetMapfileAndSymbol(IN CHAR16 *Symbol, OUT CHAR16 **MapfileName, OUT CHAR16 **SymbolName)
CHAR8 * FindSymbolStr(IN UINTN Address)
EFI_DEBUGGER_SYMBOL_OBJECT * EdbFindSymbolFile(IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate, IN CHAR16 *FileName, IN OUT UINTN *Index OPTIONAL)
EFI_STATUS EdbDeleteCodeBuffer(IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate, IN CHAR16 *MapFileName, IN CHAR16 *CodeFileName, IN VOID *SourceBuffer)
#define DEBUG(Expression)
#define CODEVIEW_SIGNATURE_NB10
#define EFI_IMAGE_DEBUG_TYPE_CODEVIEW
The Visual C++ debug information.
#define CODEVIEW_SIGNATURE_RSDS
#define EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC
#define EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC
#define EFI_IMAGE_MACHINE_EBC
EFI_STATUS EFIAPI EfiGetSystemConfigurationTable(IN EFI_GUID *TableGuid, OUT VOID **Table)
EFI_LOADED_IMAGE_PROTOCOL * LoadedImageProtocolInstance
volatile UINT32 UpdateStatus
EFI_DEBUG_IMAGE_INFO * EfiDebugImageInfoTable
UINT32 RVA
The address of the debug data when loaded, relative to the image base.
UINT32 e_lfanew
File address of new exe header.
UINT16 e_magic
Magic number.
VOID * ImageBase
The base address at which the image was loaded.