Remove global memory lock mechanism - Wasn't being used but showed up on profile report :( Move enum_pointer_fields and is_offset_pointer impls into cpp file Create enum_pointer_fields_with_offset function since the VM never needs the offset values and the generated code was about 5% bigger. Now the VM can use the callback without the offset. Removed pointless init_memory() usage since alloc_memory() now is required to return zeroed out memory. Fixed bugs in GC Added support - Ranged absolute disassembly in debugger - New duration log component
Showing the changes to src/exec/debugger.cpp (1 of 12 files). Show all
Unified · Split
| @@ -311,7 +311,7 @@ namespace · 310 unmodified lines | ||
| 311 | 311 | { |
| 312 | 312 | ss << alloc->alloc_type << " - alloc" << dbg_alloc; |
| 313 | 313 | |
| 314 | − enum_pointer_fields(*alloc->alloc_type, alloc->get_allocation(), [&ss, recurse_depth](pointer_t p, std::size_t o) | |
| 314 | + enum_pointer_fields_with_offset(*alloc->alloc_type, alloc->get_allocation(), [&ss, recurse_depth](pointer_t p, std::size_t o) | |
| 315 | 315 | { |
| 316 | 316 | ss << "\n"; |
| 317 | 317 | std::fill_n(std::ostream_iterator<std::ostream::char_type>{ ss }, 4 * recurse_depth, ' '); |
| @@ -671,11 +671,15 @@ namespace · 353 unmodified lines | ||
| 671 | 671 | |
| 672 | 672 | void cmd_disassemble(const std::vector<std::string> &a, dbg_cmd_cxt_t &cxt) |
| 673 | 673 | { |
| 674 | − auto absolute_pc = false; | |
| 675 | − auto disassemble_length = int{ 4 }; | |
| 676 | − if (a.size() > 1) | |
| 674 | + const auto &r = *cxt.current_register; | |
| 675 | + auto begin_pc = r.pc; | |
| 676 | + | |
| 677 | + const auto default_disassemble_length = int{ 4 }; | |
| 678 | + auto disassemble_length = default_disassemble_length; | |
| 679 | + for (auto i = std::size_t{ 1 }; i < a.size(); ++i) | |
| 677 | 680 | { |
| 678 | − auto disassemble_length_maybe = a[1]; | |
| 681 | + auto absolute_pc = false; | |
| 682 | + auto disassemble_length_maybe = a[i]; | |
| 679 | 683 | if (disassemble_length_maybe[0] == '@') |
| 680 | 684 | { |
| 681 | 685 | absolute_pc = true; |
| @@ -690,24 +694,22 @@ namespace · 8 unmodified lines | ||
| 690 | 694 | { |
| 691 | 695 | throw debug_cmd_error_t{ "Invalid disassemble count format" }; |
| 692 | 696 | } |
| 697 | + | |
| 698 | + if (absolute_pc) | |
| 699 | + { | |
| 700 | + begin_pc = disassemble_length; | |
| 701 | + disassemble_length = default_disassemble_length; | |
| 702 | + } | |
| 693 | 703 | } |
| 694 | 704 | |
| 705 | + auto end_pc = begin_pc; | |
| 695 | 706 | auto &dbg = cxt.dbg; |
| 696 | − const auto &r = *cxt.current_register; | |
| 697 | 707 | const auto &code_section = r.module_ref->code_section; |
| 698 | 708 | |
| 699 | − auto begin_pc = r.pc; | |
| 700 | − auto end_pc = begin_pc; | |
| 701 | − if (absolute_pc) | |
| 702 | − { | |
| 703 | − begin_pc = disassemble_length; | |
| 704 | − end_pc = disassemble_length; | |
| 705 | − disassemble_length = 0; | |
| 709 | + if (begin_pc < 0 || static_cast<int32_t>(code_section.size()) <= end_pc) | |
| 710 | + throw debug_cmd_error_t{ "Invalid absolute pc" }; | |
| 706 | 711 | |
| 707 | − if (begin_pc < 0 || static_cast<int32_t>(code_section.size()) <= end_pc) | |
| 708 | − throw debug_cmd_error_t{ "Invalid absolute pc" }; | |
| 709 | − } | |
| 710 | − else if (disassemble_length < 0) | |
| 712 | + if (disassemble_length < 0) | |
| 711 | 713 | { |
| 712 | 714 | const auto begin_maybe = begin_pc - (-disassemble_length); |
| 713 | 715 | begin_pc = std::max(begin_maybe, 0); |
| @@ -970,7 +972,7 @@ namespace · 256 unmodified lines | ||
| 970 | 972 | |
| 971 | 973 | { "sw", "Stack walk for the current or supplied thread", "sw ([0-9]+|\\*)?", "sw, sw 34, sw *", cmd_stackwalk }, |
| 972 | 974 | { "~", "Switch to thread", "~ [0-9]+", "~ 42", cmd_switchthread }, |
| 973 | − { "d", "Disassemble the next/previous N instructions (default N = 4)", "d (@?-?[0-9]+)?", "d, d -4, d 5, d @36", cmd_disassemble }, | |
| 975 | + { "d", "Disassemble the next/previous N instructions (default N = 4)", "d (@?-?[0-9]+)? (-?[0-9]+)?", "d, d -4, d 5, d @36 3", cmd_disassemble }, | |
| 974 | 976 | { "x", "Examine memory", "x [mp|fp] [0-9]+ ([0-9]+)?", "x mp 3, x fp 20 6", cmd_examine }, |
| 975 | 977 | |
| 976 | 978 | { "set" , "Set a debug option", "set [ _a-zA-Z0-9]*", "'set' for available options", set_value_cmd }, |