History

Alter debugger API to accept vector value not reference.

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

arr committed 9 years ago

Commit cc8f2b61 parent 41616d412 files · +167 −250Browse files

Showing the changes to src/exec/debugger.cpp (1 of 12 files). Show all

Unified · Split

src/exec/debugger.cpp+20−18
@@ -311,7 +311,7 @@ namespace · 310 unmodified lines
311311 {
312312 ss << alloc->alloc_type << " - alloc" << dbg_alloc;
313313
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)
315315 {
316316 ss << "\n";
317317 std::fill_n(std::ostream_iterator<std::ostream::char_type>{ ss }, 4 * recurse_depth, ' ');
@@ -671,11 +671,15 @@ namespace · 353 unmodified lines
671671
672672 void cmd_disassemble(const std::vector<std::string> &a, dbg_cmd_cxt_t &cxt)
673673 {
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)
677680 {
678− auto disassemble_length_maybe = a[1];
681+ auto absolute_pc = false;
682+ auto disassemble_length_maybe = a[i];
679683 if (disassemble_length_maybe[0] == '@')
680684 {
681685 absolute_pc = true;
@@ -690,24 +694,22 @@ namespace · 8 unmodified lines
690694 {
691695 throw debug_cmd_error_t{ "Invalid disassemble count format" };
692696 }
697+
698+ if (absolute_pc)
699+ {
700+ begin_pc = disassemble_length;
701+ disassemble_length = default_disassemble_length;
702+ }
693703 }
694704
705+ auto end_pc = begin_pc;
695706 auto &dbg = cxt.dbg;
696− const auto &r = *cxt.current_register;
697707 const auto &code_section = r.module_ref->code_section;
698708
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" };
706711
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)
711713 {
712714 const auto begin_maybe = begin_pc - (-disassemble_length);
713715 begin_pc = std::max(begin_maybe, 0);
@@ -970,7 +972,7 @@ namespace · 256 unmodified lines
970972
971973 { "sw", "Stack walk for the current or supplied thread", "sw ([0-9]+|\\*)?", "sw, sw 34, sw *", cmd_stackwalk },
972974 { "~", "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 },
974976 { "x", "Examine memory", "x [mp|fp] [0-9]+ ([0-9]+)?", "x mp 3, x fp 20 6", cmd_examine },
975977
976978 { "set" , "Set a debug option", "set [ _a-zA-Z0-9]*", "'set' for available options", set_value_cmd },