History

Add support for traps in VM Add instruction trap to enable single step scenario in debugger Remote get_state() function from thread

arr committed 9 years ago

Commit cb408a11 parent eb570d98 files · +120 −40Browse files

Showing the changes to src/include/runtime.h (1 of 8 files). Show all

Unified · Split

src/include/runtime.h+12−6
@@ -709,7 +709,7 @@ namespace disvm · 708 unmodified lines
709 const vm_string_t &exception_id);709 const vm_string_t &exception_id);
710 710
711 // VM thread states711 // VM thread states
712 enum class vm_thread_state_t : uint16_t712 enum class vm_thread_state_t : uint8_t
713 {713 {
714 unknown = 0,714 unknown = 0,
715 715
@@ -729,6 +729,13 @@ namespace disvm · 13 unmodified lines
729 broken, // thread crashed - the scheduler is free to terminate the entire VM if any thread enters this state.729 broken, // thread crashed - the scheduler is free to terminate the entire VM if any thread enters this state.
730 };730 };
731 731
732 // VM trap flags
733 enum class vm_trap_flags_t : uint8_t
734 {
735 none = 0,
736 instruction = 1 << 0,
737 };
738
732 // Forward declaration739 // Forward declaration
733 class vm_thread_t;740 class vm_thread_t;
734 class vm_tool_dispatch_t;741 class vm_tool_dispatch_t;
@@ -738,11 +745,11 @@ namespace disvm · 3 unmodified lines
738 {745 {
739 public:746 public:
740 vm_registers_t(747 vm_registers_t(
741 const vm_thread_t &thread,748 vm_thread_t &thread,
742 vm_module_ref_t &entry);749 vm_module_ref_t &entry);
743 ~vm_registers_t();750 ~vm_registers_t();
744 751
745 const vm_thread_t &thread;752 vm_thread_t &thread;
746 std::atomic<vm_tool_dispatch_t *> tool_dispatch;753 std::atomic<vm_tool_dispatch_t *> tool_dispatch;
747 vm_stack_t stack; // Frame pointer access (FP)754 vm_stack_t stack; // Frame pointer access (FP)
748 vm_pc_t pc; // Current Program counter (Index into module code section)755 vm_pc_t pc; // Current Program counter (Index into module code section)
@@ -751,8 +758,9 @@ namespace disvm · 2 unmodified lines
751 vm_module_ref_t *module_ref; // Module reference758 vm_module_ref_t *module_ref; // Module reference
752 vm_request_mutex_t request_mutex;759 vm_request_mutex_t request_mutex;
753 760
754 vm_thread_state_t current_thread_state;
755 uint16_t current_thread_quanta;761 uint16_t current_thread_quanta;
762 vm_thread_state_t current_thread_state;
763 vm_trap_flags_t trap_flags;
756 764
757 pointer_t src;765 pointer_t src;
758 pointer_t mid;766 pointer_t mid;
@@ -795,8 +803,6 @@ namespace disvm · 36 unmodified lines
795 // this vm thread.803 // this vm thread.
796 void set_tool_dispatch(vm_tool_dispatch_t *dispatch);804 void set_tool_dispatch(vm_tool_dispatch_t *dispatch);
797 805
798 vm_thread_state_t get_state() const;
799
800 // This function will only return a non-null806 // This function will only return a non-null
801 // value if this thread is in the broken state.807 // value if this thread is in the broken state.
802 const char *get_error_message() const;808 const char *get_error_message() const;