| 431 | } |
| 432 | |
| 433 | void cs_debugger_func_callback(const std::string &decl, cs::statement_base *stmt) |
| 434 | { |
| 435 | if (context->compiler->csyms.count(stmt->get_file_path()) > 0) { |
| 436 | cs::csym_info &csym = context->compiler->csyms[stmt->get_file_path()]; |
| 437 | std::size_t current_line = stmt->get_line_num(); |
| 438 | if (current_line >= csym.map.size()) |
| 439 | return; |
| 440 | std::size_t actual_line = csym.map[current_line - 1]; |
| 441 | if (actual_line >= csym.codes.size() || actual_line == 0) |
| 442 | return; |
| 443 | std::cout << "\nHit breakpoint, at \"" << csym.file << "\", line " << actual_line << ", " << decl << std::endl; |
| 444 | } |
| 445 | else |
| 446 | std::cout << "\nHit breakpoint, at \"" << stmt->get_file_path() << "\", line " << stmt->get_line_num() << ", " << decl << std::endl; |
| 447 | current_level = cs::current_process->stack.size(); |
| 448 | exec_by_step = true; |
| 449 | } |
| 450 | |
| 451 | cs::array split(const std::string &str) |
| 452 | { |