MCPcopy Create free account
hub / github.com/beefytech/Beef / TryLoadPDB

Method TryLoadPDB

IDEHelper/COFF.cpp:6027–6140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6025}
6026
6027bool COFF::TryLoadPDB(const String& pdbPath, uint8 wantGuid[16], int32 wantAge)
6028{
6029 bool isVerifyOnly = mDebugger == NULL;
6030
6031 if (!mPDBPath.IsEmpty())
6032 return false; // Already have a PDB loaded
6033
6034 mCvMappedFile = CreateFileA(pdbPath.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, NULL, NULL);
6035 if (mCvMappedFile == INVALID_HANDLE_VALUE)
6036 {
6037 return false;
6038 }
6039
6040 BP_ZONE("COFF::TryLoadPDB");
6041
6042 if (!isVerifyOnly && !(gDebugManager->GetOutputFilterFlags() & BfOutputFilterFlags_SymbolLoadMessages))
6043 mDebugger->OutputMessage(StrFormat("Loading PDB %s\n", pdbPath.c_str()));
6044
6045 DWORD highFileSize = 0;
6046 int fileSize = (int)GetFileSize(mCvMappedFile, &highFileSize);
6047 mCvMappedFileMapping = CreateFileMapping(mCvMappedFile, NULL, PAGE_READONLY, 0, fileSize, NULL);
6048 mCvMappedViewOfFile = MapViewOfFile(mCvMappedFileMapping, FILE_MAP_READ, 0, 0, fileSize);
6049 mCvMappedFileSize = fileSize;
6050
6051 //FileStream pdbFS;
6052 //if (!pdbFS.Open(pdbPath, "rb"))
6053 //return false;
6054
6055 mPDBPath = pdbPath;
6056 mCvDataStream = new SafeMemStream(mCvMappedViewOfFile, fileSize, false);
6057
6058 //Cv_HEADER
6059 //pdbFS.Read
6060
6061 char sig[32];
6062 mCvDataStream->Read(sig, 32);
6063 if (memcmp(sig, MSF_SIGNATURE_700, 32) != 0)
6064 {
6065 if (!isVerifyOnly)
6066 Fail("PDB signature error");
6067 return false;
6068 }
6069
6070 BfLogDbg("Loading PDB %s\n", pdbPath.c_str());
6071
6072 BP_ZONE_F("LoadCv %s", pdbPath.c_str());
6073
6074 int pageSize = mCvDataStream->ReadInt32();
6075 int fpmPageNum = mCvDataStream->ReadInt32();
6076 int totalPageCount = mCvDataStream->ReadInt32();
6077 int rootDirSize = mCvDataStream->ReadInt32();
6078 int unknown = mCvDataStream->ReadInt32();
6079
6080 int rootDirPtrs[NUM_ROOT_DIRS];
6081 mCvDataStream->ReadT(rootDirPtrs);
6082
6083 bool failed = false;
6084

Callers 4

CheckPDBDataMethod · 0.80
PdbTestFileFunction · 0.80
TestPDBFunction · 0.80

Calls 12

FailFunction · 0.85
GetOutputFilterFlagsMethod · 0.80
ReadInt32Method · 0.80
ReadTMethod · 0.80
ModuleChangedMethod · 0.80
IsEmptyMethod · 0.45
c_strMethod · 0.45
OutputMessageMethod · 0.45
ReadMethod · 0.45
ResizeMethod · 0.45
SetPosMethod · 0.45
sizeMethod · 0.45

Tested by 1

TestPDBFunction · 0.64