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

Method CreateModuleStreamSyms

IDEHelper/Linker/BlCodeView.cpp:1409–2016  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1407}
1408
1409void BlCodeView::CreateModuleStreamSyms(BlCvModuleInfo* module, BlCvSymDataBlock* dataBlock, int dataOfs)
1410{
1411 //BL_AUTOPERF_CV("BlCodeView::CreateModuleStreamSyms");
1412
1413 int streamStartPos = mWriter.GetStreamPos();
1414
1415#define DECL_SYM(symType, symName) \
1416 symType& old_##symName = *(symType*)dataStart; \
1417 symType& symName = *((symType*)(dataOut += sizeof(symType)) - 1); \
1418 symName = old_##symName;
1419
1420#define _FIX_SYM_ADDRESS(ofsName) \
1421 FixSymAddress(sectionStart, &old_##ofsName, &ofsName, module, dataBlock, nextReloc)
1422
1423#define FIX_SYM_ADDRESS(ofsName) \
1424 _FixSymAddress(&old_##ofsName, &ofsName)
1425
1426 #define FIXTPI(typeVal) \
1427 FixTPITag(module, typeVal)
1428 #define FIXIPI(typeVal) \
1429 FixIPITag(module, typeVal)
1430
1431
1432 // For FIXTPI, if we fail to lookup type then we just don't include this symbol.
1433 // This can happen when we have a TYPESERVER but don't have the referenced PDB
1434/*#define FIXTPI(typeVal) \
1435 if (!FixType(module, typeVal)) \
1436 { \
1437 dataOut = dataOutStart; \
1438 data = dataEnd; \
1439 continue; \
1440 }*/
1441
1442 COFFRelocation* nextReloc = dataBlock->mRelocStart;
1443 int dataOutMaxSize = dataBlock->mSize * 2; // Alignment may add size
1444 //uint8* dataOut = new uint8[dataOutMaxSize];
1445 //uint8* dataOutHead = dataOut;
1446 //uint8* dataOutMax = dataOut + dataOutMaxSize;
1447
1448 const static int MAX_BLOCK_DEPTH = 256;
1449
1450 int blockIdx = 0;
1451 //int blockPositions[MAX_BLOCK_DEPTH];
1452 int blockPtrs[MAX_BLOCK_DEPTH];
1453
1454 const char* lastProcName = NULL;
1455
1456 int curStreamPos = streamStartPos;
1457 int streamDataOfs = -streamStartPos + dataOfs;
1458
1459 static int procId = 0;
1460
1461 uint8* data = (uint8*)dataBlock->mData;
1462 uint8* sectionStart = data;
1463 uint8* sectionEnd = data + dataBlock->mSize;
1464 uint8 dataChunk[0x10000];
1465
1466 auto _SkipSymAddress = [&](void* oldDataPos, void* outDataPos)

Callers

nothing calls this directly

Calls 6

FailFunction · 0.85
GetStreamPtrMethod · 0.80
TryInsertMethod · 0.80
GetStreamPosMethod · 0.45
WriteMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected