| 123 | } |
| 124 | |
| 125 | void cmDebuggerBreakpointManager::SourceFileLoaded( |
| 126 | std::string const& sourcePath, |
| 127 | std::vector<cmListFileFunction> const& functions) |
| 128 | { |
| 129 | std::unique_lock<std::mutex> lock(Mutex); |
| 130 | if (ListFileFunctionLines.find(sourcePath) != ListFileFunctionLines.end()) { |
| 131 | // this is not expected. |
| 132 | return; |
| 133 | } |
| 134 | |
| 135 | for (cmListFileFunction const& func : functions) { |
| 136 | ListFileFunctionLines[sourcePath].emplace_back( |
| 137 | cmDebuggerFunctionLocation{ func.Line(), func.LineEnd() }); |
| 138 | } |
| 139 | |
| 140 | if (ListFilePendingValidations.find(sourcePath) == |
| 141 | ListFilePendingValidations.end()) { |
| 142 | return; |
| 143 | } |
| 144 | |
| 145 | ListFilePendingValidations.erase(sourcePath); |
| 146 | |
| 147 | for (size_t i = 0; i < Breakpoints[sourcePath].size(); i++) { |
| 148 | dap::BreakpointEvent breakpointEvent; |
| 149 | breakpointEvent.breakpoint.id = Breakpoints[sourcePath][i].GetId(); |
| 150 | breakpointEvent.breakpoint.line = Breakpoints[sourcePath][i].GetLine(); |
| 151 | auto source = dap::Source(); |
| 152 | source.path = sourcePath; |
| 153 | breakpointEvent.breakpoint.source = source; |
| 154 | int64_t correctedLine = CalibrateBreakpointLine( |
| 155 | sourcePath, Breakpoints[sourcePath][i].GetLine()); |
| 156 | if (correctedLine != Breakpoints[sourcePath][i].GetLine()) { |
| 157 | Breakpoints[sourcePath][i].ChangeLine(correctedLine); |
| 158 | } |
| 159 | breakpointEvent.reason = "changed"; |
| 160 | breakpointEvent.breakpoint.verified = (correctedLine > 0); |
| 161 | if (breakpointEvent.breakpoint.verified) { |
| 162 | breakpointEvent.breakpoint.line = correctedLine; |
| 163 | } else { |
| 164 | Breakpoints[sourcePath][i].Invalid(); |
| 165 | } |
| 166 | |
| 167 | DapSession->send(breakpointEvent); |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | std::vector<int64_t> cmDebuggerBreakpointManager::GetBreakpoints( |
| 172 | std::string const& sourcePath, int64_t line) |