| 13443 | } |
| 13444 | |
| 13445 | void WinDebugger::FixupLineDataForSubprogram(DbgSubprogram* subProgram) |
| 13446 | { |
| 13447 | if ((subProgram == NULL) || (!subProgram->mNeedLineDataFixup)) |
| 13448 | return; |
| 13449 | |
| 13450 | BP_ZONE("FixupLineDataForSubprogram"); |
| 13451 | |
| 13452 | subProgram->mNeedLineDataFixup = false; |
| 13453 | if (subProgram->mInlineeInfo != NULL) |
| 13454 | FixupLineDataForSubprogram(subProgram->mInlineeInfo->mRootInliner); |
| 13455 | |
| 13456 | if ((subProgram->mLineInfo == NULL) || (subProgram->mLineInfo->mLines.mSize == 0)) |
| 13457 | return; |
| 13458 | |
| 13459 | //TODO: I think this was covering up a bug in DWARF line encoding? Figure this out |
| 13460 | // if (subProgram->mLineInfo->mLines.mSize >= 2) |
| 13461 | // { |
| 13462 | // DbgLineData* line0 = &subProgram->mLineInfo->mLines[0]; |
| 13463 | // DbgLineData* line1 = &subProgram->mLineInfo->mLines[1]; |
| 13464 | // |
| 13465 | // |
| 13466 | // if ((line0->mRelAddress == line1->mRelAddress) && (!line0->IsStackFrameSetup()) && (line1->IsStackFrameSetup())) |
| 13467 | // { |
| 13468 | // CPUInst inst; |
| 13469 | // if (mCPU->Decode(line0->mAddress, subProgram->mCompileUnit->mDbgModule->mOrigImageData, &inst)) |
| 13470 | // line1->mAddress += inst.GetLength(); |
| 13471 | // } |
| 13472 | // } |
| 13473 | |
| 13474 | qsort(subProgram->mLineInfo->mLines.mVals, subProgram->mLineInfo->mLines.mSize, sizeof(DbgLineData), CompareLineData); |
| 13475 | |
| 13476 | // If we have multiple lines with the same line/column/context, merge them |
| 13477 | if (!subProgram->mLineInfo->mLines.IsEmpty()) |
| 13478 | { |
| 13479 | auto prevLine = &subProgram->mLineInfo->mLines[0]; |
| 13480 | for (int i = 1; i < subProgram->mLineInfo->mLines.mSize; i++) |
| 13481 | { |
| 13482 | auto nextLine = &subProgram->mLineInfo->mLines[i]; |
| 13483 | |
| 13484 | if ((nextLine->mLine == prevLine->mLine) && (nextLine->mColumn == prevLine->mColumn) && (nextLine->mCtxIdx == prevLine->mCtxIdx) && |
| 13485 | (nextLine->mRelAddress == prevLine->mRelAddress + prevLine->mContribSize)) |
| 13486 | { |
| 13487 | prevLine->mContribSize += nextLine->mContribSize; |
| 13488 | // This messed up inline cases because mContribSize actually INCLUDES inlined lines so it caused the address to skip too far |
| 13489 | //nextLine->mRelAddress += nextLine->mContribSize; |
| 13490 | //nextLine->mContribSize = 0; |
| 13491 | } |
| 13492 | else |
| 13493 | { |
| 13494 | prevLine = nextLine; |
| 13495 | } |
| 13496 | } |
| 13497 | } |
| 13498 | } |
| 13499 | |
| 13500 | void WinDebugger::ReserveHotTargetMemory(int size) |
| 13501 | { |