| 6320 | } |
| 6321 | |
| 6322 | intptr 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 |
no test coverage detected