| 12097 | } |
| 12098 | |
| 12099 | String WinDebugger::FindCodeAddresses(const StringImpl& fileName, int line, int column, bool allowAutoResolve) |
| 12100 | { |
| 12101 | String result; |
| 12102 | if (mDebugTarget == NULL) |
| 12103 | return ""; |
| 12104 | |
| 12105 | DbgSrcFile* srcFile = mDebugTarget->GetSrcFile(fileName); |
| 12106 | if (srcFile == NULL) |
| 12107 | return result; |
| 12108 | |
| 12109 | bool foundInSequence = false; |
| 12110 | WdBreakpoint* prevBreakpoint = NULL; |
| 12111 | |
| 12112 | int bestLineOffset = 0x7FFFFFFF; |
| 12113 | |
| 12114 | for (auto dbgSubprogram : srcFile->mLineDataRefs) |
| 12115 | { |
| 12116 | for (auto& lineData : dbgSubprogram->mLineInfo->mLines) |
| 12117 | { |
| 12118 | auto lineSrcFile = dbgSubprogram->GetLineSrcFile(lineData); |
| 12119 | if (lineSrcFile != srcFile) |
| 12120 | continue; |
| 12121 | int lineOffset = lineData.mLine - line; |
| 12122 | |
| 12123 | if ((lineOffset >= 0) && (lineOffset <= 12) && (lineOffset <= bestLineOffset)) |
| 12124 | { |
| 12125 | if (lineOffset < bestLineOffset) |
| 12126 | { |
| 12127 | bestLineOffset = lineOffset; |
| 12128 | result = ""; |
| 12129 | } |
| 12130 | |
| 12131 | if (!foundInSequence) |
| 12132 | { |
| 12133 | auto addr = dbgSubprogram->GetLineAddr(lineData); |
| 12134 | result += EncodeDataPtr(addr, false) + "\t" + dbgSubprogram->ToString() + "\n"; |
| 12135 | } |
| 12136 | } |
| 12137 | |
| 12138 | // New sequence? |
| 12139 | if (!lineData.IsStackFrameSetup()) |
| 12140 | foundInSequence = false; |
| 12141 | } |
| 12142 | } |
| 12143 | |
| 12144 | return result; |
| 12145 | } |
| 12146 | |
| 12147 | String WinDebugger::GetAddressSourceLocation(intptr address) |
| 12148 | { |
no test coverage detected