| 269 | } |
| 270 | |
| 271 | std::string LRemoteDebugger::process_cmd_info(LRemoteDebuggerCommandInfo cmd_info, bool send_response) |
| 272 | { |
| 273 | if (cmd_info.operation.length() < 1) |
| 274 | return "empty command"; |
| 275 | if(cmd_info.operation=="add") |
| 276 | { |
| 277 | if (cmd_info.filename.length() < 1) |
| 278 | return "empty add command"; |
| 279 | auto filename_found = _debugger_source_lines.find(cmd_info.filename); |
| 280 | if (filename_found == _debugger_source_lines.end()) |
| 281 | { |
| 282 | std::vector<int> linenumbers; |
| 283 | for (size_t line : cmd_info.linenumbers) |
| 284 | { |
| 285 | int line_int = (int)line; |
| 286 | linenumbers.push_back(line_int); |
| 287 | } |
| 288 | _debugger_source_lines[cmd_info.filename] = linenumbers; |
| 289 | return "add successfully"; |
| 290 | } |
| 291 | auto linenumbers = filename_found->second; |
| 292 | for(size_t line : cmd_info.linenumbers) |
| 293 | { |
| 294 | int line_int = static_cast<int>(line); |
| 295 | if(!glua::util::vector_contains(linenumbers, line_int)) |
| 296 | { |
| 297 | linenumbers.push_back(line_int); |
| 298 | } |
| 299 | } |
| 300 | return "add successfully"; |
| 301 | } else if(cmd_info.operation == "remove") |
| 302 | { |
| 303 | if (cmd_info.filename.length() < 1) |
| 304 | return "empty filename"; |
| 305 | auto filename_found = _debugger_source_lines.find(cmd_info.filename); |
| 306 | if (filename_found == _debugger_source_lines.end()) |
| 307 | return "filename not found of remove cmd"; |
| 308 | auto linenumbers = filename_found->second; |
| 309 | for (size_t line : cmd_info.linenumbers) |
| 310 | { |
| 311 | int line_int = static_cast<int>(line); |
| 312 | if (glua::util::vector_contains(linenumbers, line_int)) |
| 313 | { |
| 314 | std::remove(linenumbers.begin(), linenumbers.end(), line_int); |
| 315 | } |
| 316 | } |
| 317 | return "remove successfully"; |
| 318 | } else if(cmd_info.operation == "remove_line_all") |
| 319 | { |
| 320 | if (cmd_info.filename.length() < 1) |
| 321 | return "empty remove_line_all cmd"; |
| 322 | auto filename_found = _debugger_source_lines.find(cmd_info.filename); |
| 323 | if (filename_found == _debugger_source_lines.end()) |
| 324 | return "filename to remove lines not found"; |
| 325 | auto linenumbers = filename_found->second; |
| 326 | linenumbers.clear(); |
| 327 | return "remove_line_all"; |
| 328 | } else if(cmd_info.operation == "remove_all") |
nothing calls this directly
no test coverage detected