MCPcopy Create free account
hub / github.com/covscript/covscript / cs_debugger_step_callback

Function cs_debugger_step_callback

sources/debugger.cpp:386–426  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

384}
385
386void cs_debugger_step_callback(cs::statement_base *stmt)
387{
388 if (stmt->get_file_path() != path)
389 return;
390 if (context->compiler->csyms.count(path) > 0) {
391 cs::csym_info &csym = context->compiler->csyms[path];
392 std::size_t current_line = stmt->get_line_num();
393 if (current_line >= csym.map.size())
394 return;
395 std::size_t actual_line = csym.map[current_line - 1];
396 if (actual_line >= csym.codes.size() || actual_line == 0)
397 return;
398 const std::string &code = csym.codes[actual_line - 1];
399 if (!exec_by_step && breakpoints.exist(actual_line)) {
400 std::cout << "\nHit breakpoint, at \"" << csym.file << "\", line " << actual_line
401 << std::endl;
402 current_level = cs::current_process->stack.size();
403 exec_by_step = true;
404 }
405 if (exec_by_step && (step_into_function || cs::current_process->stack.size() <= current_level)) {
406 std::cout << actual_line << "\t" << code << std::endl;
407 current_level = cs::current_process->stack.size();
408 step_into_function = false;
409 while (covscript_debugger());
410 }
411 }
412 else {
413 if (!exec_by_step && breakpoints.exist(stmt->get_line_num())) {
414 std::cout << "\nHit breakpoint, at \"" << stmt->get_file_path() << "\", line " << stmt->get_line_num()
415 << std::endl;
416 current_level = cs::current_process->stack.size();
417 exec_by_step = true;
418 }
419 if (exec_by_step && (step_into_function || cs::current_process->stack.size() <= current_level)) {
420 std::cout << stmt->get_line_num() << "\t" << stmt->get_raw_code() << std::endl;
421 current_level = cs::current_process->stack.size();
422 step_into_function = false;
423 while (covscript_debugger());
424 }
425 }
426}
427
428void cs_debugger_func_breakpoint(const std::string &name, const cs::var &func)
429{

Callers

nothing calls this directly

Calls 4

covscript_debuggerFunction · 0.85
sizeMethod · 0.80
get_line_numMethod · 0.45
existMethod · 0.45

Tested by

no test coverage detected