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

Method CvParseSymbol

IDEHelper/COFF.cpp:5420–5712  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5418}
5419
5420const char* COFF::CvParseSymbol(int offset, CvSymStreamType symStreamType, addr_target& outAddr)
5421{
5422 const char* retName = NULL;
5423
5424 int offsetStart = offset;
5425 uint8* data = mCvSymbolRecordReader.GetTempPtr(offset, 4);
5426 uint16 symLen = *(uint16*)data;
5427 bool madeCopy = false;
5428 data = mCvSymbolRecordReader.GetTempPtr(offset, symLen + 2, false, &madeCopy);
5429 uint8* dataStart = data;
5430 uint16 symType = *(uint16*)(data + 2);
5431
5432 BF_ASSERT(symLen % 4 == 2);
5433 BF_ASSERT((intptr)data % 4 == 0);
5434
5435 char* scanName = NULL;
5436
5437 switch (symType)
5438 {
5439 case S_UDT:
5440 {
5441 UDTSYM& udt = *(UDTSYM*)dataStart;
5442 const char* name = (const char*)udt.name;
5443
5444#ifdef _DEBUG
5445 ParseTypeData();
5446 auto type = CvGetType(udt.typind);
5447#endif
5448 retName = name;
5449 }
5450 break;
5451 case S_PUB32:
5452 {
5453 PUBSYM32& pubSym = *(PUBSYM32*)dataStart;
5454
5455 if (symStreamType != CvSymStreamType_Symbols)
5456 break;
5457
5458 BP_ALLOC_T(DbgSymbol);
5459 DbgSymbol* dbgSymbol = mAlloc.Alloc<DbgSymbol>();
5460
5461 const char* name = (const char*)mCvSymbolRecordReader.GetPermanentPtr(offsetStart + offsetof(PUBSYM32, name), symLen - offsetof(PUBSYM32, name) + 2); // pubSym.name;
5462 //OutputDebugStrF("Sym: %s\n", name);
5463#ifdef BF_DBG_32
5464 if ((name != NULL) && (name[0] == '_'))
5465 name++;
5466#endif
5467
5468 dbgSymbol->mName = name;
5469 dbgSymbol->mAddress = GetSectionAddr(pubSym.seg, pubSym.off);
5470 dbgSymbol->mDbgModule = this;
5471
5472 if ((dbgSymbol->mAddress >= mImageBase) && (dbgSymbol->mAddress < mImageBase + mImageSize))
5473 {
5474 if ((dbgSymbol->mAddress & 0xFFFF'0000'0000'0000) == 0)
5475 mDebugTarget->mSymbolMap.Insert(dbgSymbol);
5476 }
5477 else

Callers

nothing calls this directly

Calls 9

GetNamespaceEndFunction · 0.85
StringClass · 0.85
GetTempPtrMethod · 0.80
GetPermanentPtrMethod · 0.80
InsertMethod · 0.45
PushFrontMethod · 0.45
push_backMethod · 0.45
PushBackMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected