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

Method EvaluateLocation

IDEHelper/COFF.cpp:6322–6540  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6320}
6321
6322intptr COFF::EvaluateLocation(DbgSubprogram* dwSubprogram, const uint8* locData, int locDataLen, WdStackFrame* stackFrame, DbgAddrType* outAddrType, DbgEvalLocFlags flags)
6323{
6324 if (mDbgFlavor == DbgFlavor_GNU)
6325 return DbgModule::EvaluateLocation(dwSubprogram, locData, locDataLen, stackFrame, outAddrType, flags);
6326
6327 if ((locDataLen == 0) && (locData != NULL))
6328 {
6329 // locData is actually a string, the aliased name
6330 *outAddrType = DbgAddrType_Alias;
6331 return (intptr)locData;
6332 }
6333
6334 addr_target pc = 0;
6335 if (stackFrame != NULL)
6336 {
6337 // Use 'GetSourcePC', which will offset the RSP when we're not at the top position of the call stack, since RSP will be the
6338 // return address in those cases
6339 pc = stackFrame->GetSourcePC();
6340 }
6341
6342 int inlineDepth = 0;
6343 uint8* data = (uint8*)locData;
6344 for (int locIdx = 0; locIdx < locDataLen; locIdx++)
6345 {
6346 uint8* dataStart = data;
6347 GET_INTO(uint16, symLen);
6348 uint8* dataEnd = data + symLen;
6349 GET_INTO(uint16, symType);
6350
6351 CV_LVAR_ADDR_RANGE* rangeInfo = NULL;
6352 CV_LVAR_ADDR_GAP* gapsInfo = NULL;
6353 addr_target result = 0;
6354
6355 if (inlineDepth > 0)
6356 {
6357 if (symType == S_INLINESITE)
6358 inlineDepth++;
6359 else if (symType == S_INLINESITE_END)
6360 inlineDepth--;
6361 data = dataEnd;
6362 continue;
6363 }
6364
6365 bool handled = false;
6366 switch (symType)
6367 {
6368 case S_GDATA32:
6369 case S_LDATA32:
6370 {
6371 DATASYM32& dataSym = *(DATASYM32*)dataStart;
6372 *outAddrType = DbgAddrType_Target;
6373 return GetSectionAddr(dataSym.seg, dataSym.off);
6374 }
6375 break;
6376 case S_BPREL32:
6377 {
6378 BPRELSYM32* bpRel32 = (BPRELSYM32*)dataStart;
6379#if BF_DBG_32

Callers 6

GetBeefTypeByIdMethod · 0.45
DoLookupFieldMethod · 0.45
ScanMethod · 0.45
GetStaticAddressMethod · 0.45

Calls 2

GetSourcePCMethod · 0.80
GetTLSOffsetMethod · 0.80

Tested by

no test coverage detected