| 3278 | } |
| 3279 | |
| 3280 | void WinDebugger::CheckBreakpoint(WdBreakpoint* wdBreakpoint, DbgSrcFile* srcFile, int lineNum, int hotIdx) |
| 3281 | { |
| 3282 | BP_ZONE("WinDebugger::CheckBreakpoint:atLoc"); |
| 3283 | |
| 3284 | if (hotIdx == -1) |
| 3285 | { |
| 3286 | BF_ASSERT(wdBreakpoint->mPendingHotBindIdx == -1); |
| 3287 | } |
| 3288 | WdBreakpoint* headBreakpoint = wdBreakpoint; |
| 3289 | headBreakpoint->mPendingHotBindIdx = -1; |
| 3290 | |
| 3291 | bool foundInSequence = false; |
| 3292 | DbgSubprogram* lastFoundSubprogram = NULL; |
| 3293 | |
| 3294 | int highestHotIdx = -1; |
| 3295 | bool foundLine = false; |
| 3296 | |
| 3297 | int bestLineNum = -1; |
| 3298 | int bestLineOffset = 0x7FFFFFFF; |
| 3299 | |
| 3300 | auto _CheckLineInfo = [&](DbgSubprogram* dbgSubprogram, DbgLineInfo* dbgLineInfo) |
| 3301 | { |
| 3302 | // Scan first so we can determine if we want to do fix up line data or not. |
| 3303 | bool hasNear = false; |
| 3304 | int maxLineDist = 6; |
| 3305 | |
| 3306 | for (int lineIdx = 0; lineIdx < dbgLineInfo->mLines.mSize; lineIdx++) |
| 3307 | { |
| 3308 | auto lineData = &dbgLineInfo->mLines[lineIdx]; |
| 3309 | auto& ctx = dbgLineInfo->mContexts[lineData->mCtxIdx]; |
| 3310 | if (ctx.mSrcFile != srcFile) |
| 3311 | continue; |
| 3312 | |
| 3313 | int lineOffset = lineData->mLine - lineNum; |
| 3314 | if ((lineOffset >= 0) && (lineOffset <= maxLineDist)) |
| 3315 | hasNear = true; |
| 3316 | } |
| 3317 | |
| 3318 | if (!hasNear) |
| 3319 | return; |
| 3320 | |
| 3321 | FixupLineDataForSubprogram(dbgSubprogram); |
| 3322 | |
| 3323 | for (int lineIdx = 0; lineIdx < dbgLineInfo->mLines.mSize; lineIdx++) |
| 3324 | { |
| 3325 | //TODO: Do fixup lineData... ? |
| 3326 | auto lineData = &dbgLineInfo->mLines[lineIdx]; |
| 3327 | auto& ctx = dbgLineInfo->mContexts[lineData->mCtxIdx]; |
| 3328 | if (ctx.mSrcFile != srcFile) |
| 3329 | continue; |
| 3330 | |
| 3331 | // if (ctx.mInlinee != NULL) |
| 3332 | // { |
| 3333 | // if (lineIdx + 1 < dbgLineInfo->mLines.mSize) |
| 3334 | // { |
| 3335 | // auto nextLineData = &dbgLineInfo->mLines[lineIdx + 1]; |
| 3336 | // if (nextLineData->mRelAddress == lineData->mRelAddress) |
| 3337 | // { |
no test coverage detected