Beispiel #1
0
        public VMItem(XmlAttributeCollection MachineAttrs)
        {
            string home = Environment.GetFolderPath(Environment.SpecialFolder.Personal);

            uuid = MachineAttrs["uuid"].Value.Replace("{", "").Replace("}", "");
            //find machine specific xml file
            string MachineSource = MachineAttrs["src"].Value;

            if (!File.Exists(MachineSource))
            {
                MachineSource = Path.Combine(Path.Combine(home, ".VirtualBox"), MachineSource);
            }
            //find the OS type of the machine
            XmlDocument MachineDoc = new XmlDocument();

            MachineDoc.Load(MachineSource);
            XmlNodeList MachineInfo = MachineDoc.GetElementsByTagName("Machine");

            name = MachineInfo[0].Attributes["name"].Value;
            try
            {
                string icon = IconMap.LookUp(MachineInfo[0].Attributes["OSType"].Value);
                ico_file = string.Format("os_{0}.png@{1}", icon, GetType().Assembly.FullName);
            }
            catch             //something went bad trying to assign an icon
            {
                Log <VMItem> .Warn("Could not determine machine type for VM: {0}", name);

                ico_file = string.Format("VirtualBox_64px.png@{0}", GetType().Assembly.FullName);
            }
            this.state = CurrentState;
            Log <VMItem> .Info("VM: {0} indexed [State: {1} Uuid: {2}]", name, state, uuid);
        }
Beispiel #2
0
        public VMState StepOut()
        {
            VMState vms = null;

            DebuggerStateCheckBeforeRun();

            if (core.DebugProps.DebugStackFrameContains(ProtoCore.DebugProperties.StackFrameFlagOptions.FepRun))
            {
                core.DebugProps.RunMode        = ProtoCore.Runmode.StepOut;
                core.DebugProps.AllbreakPoints = allbreakPoints;

                core.DebugProps.StepOutReturnPC = (int)core.Rmem.GetAtRelative(StackFrame.kFrameIndexReturnAddress).opdata;

                List <Instruction> instructions = new List <Instruction>();
                foreach (Breakpoint bp in RegisteredBreakpoints)
                {
                    instructions.Add(BreakpointToInstruction(bp));
                }
                vms = RunVM(instructions);
            }
            else
            {
                vms = Run();
            }

            return(vms);
        }
Beispiel #3
0
 //complicated constructor if you want to supply everything
 public VMThread(string o1, string o2, VMState ns, ref VMItem v)
 {
     this.op1      = o1;
     this.op2      = o2;
     this.NewState = ns;
     this.vm       = v;
 }
Beispiel #4
0
 public VMDynItm(string n, string d, string i, VMState m)
 {
     name = n;
     desc = d;
     icon = i;
     mode = m;
 }
Beispiel #5
0
 public override void DragMove(Coordinate distance)
 {
     if (_state == VMState.None) return;
     _state = VMState.Moving;
     // Move the origin point by the delta value
     _origin.Move(distance);
 }
Beispiel #6
0
 public VMDynItm(string n, string d, string i, VMState m)
 {
     name = n;
     desc = d;
     icon = i;
     mode = m;
 }
Beispiel #7
0
 protected override void Reload(VMState state)
 {
     if (state != null)
     {
         SelectedBookItem = EDOUtils.FindOrFirst(books, state.State1);
     }
 }
Beispiel #8
0
        public VMState StepOver()
        {
            DebuggerStateCheckBeforeRun();
            // check if the current instruction is a function call instruction
            // if it is, set a breakpoint at the next instruction and call Run
            // if not, call Step
            VMState vms = null;

            core.DebugProps.AllbreakPoints = allbreakPoints;
            Instruction instr = GetCurrentInstruction();

            if (instr.opCode == OpCode.CALL ||
                instr.opCode == OpCode.CALLR)
            {
                core.DebugProps.RunMode = ProtoCore.Runmode.StepNext;
                List <Instruction> instructions = new List <Instruction>();
                foreach (Breakpoint bp in RegisteredBreakpoints)
                {
                    instructions.Add(BreakpointToInstruction(bp));
                }
                vms = RunVM(instructions);
            }
            else
            {
                vms = Step();
            }

            return(vms);
        }
Beispiel #9
0
 /// <summary>
 /// Viewの切り替え時に実行されます。
 /// </summary>
 public void Reload()
 {
     //It is called when DataContext is changed.
     //Restore the state here
     Reload(state);
     state = null;
 }
 public VMDetails(string VMID, string resourceGroup, VMState VMState, string size, string region)
 {
     PartitionKey = resourceGroup;
     RowKey       = VMID;
     Region       = region;
     Size         = Size;
     State        = VMState;
 }
Beispiel #11
0
 public override void ToolSelected(bool preventHistory)
 {
     _state     = VMState.None;
     _originals = MainTool.Points.ToDictionary(x => x, x => x.Coordinate);
     DocumentGridSpacingChanged(Document.Map.GridSpacing);
     ResetOrigin(null);
     Mediator.Subscribe(EditorMediator.DocumentGridSpacingChanged, this);
 }
Beispiel #12
0
 public static T FindOrFirst <T>(Collection <T> collection, VMState state) where T : class, IStringIDProvider
 {
     if (state == null)
     {
         return(GetFirst(collection));
     }
     return(FindOrFirst <T>(collection, state.State1));
 }
        public async Task <IEnumerable <VMDetails> > GetAllVMsInStateAsync(VMState state)
        {
            CloudTable table = tableClient.GetTableReference(tableName);
            var        query = new TableQuery <VMDetails>().Where
                                   (TableQuery.GenerateFilterConditionForInt(nameof(VMDetails.VMStateValue), QueryComparisons.Equal, Convert.ToInt32(state)));

            return(await GetAllFromTableAsync(table, query));
        }
Beispiel #14
0
 public void Execute()
 {
     State &= ~VMState.BREAK;
     while (!State.HasFlag(VMState.HALT) && !State.HasFlag(VMState.FAULT) && !State.HasFlag(VMState.BREAK))
     {
         StepInto();
     }
 }
Beispiel #15
0
        void IInteroperable.FromStackItem(StackItem stackItem)
        {
            Struct @struct = (Struct)stackItem;

            BlockIndex      = (uint)@struct[0].GetInteger();
            _rawTransaction = @struct[1];
            Transaction     = _rawTransaction.GetSpan().AsSerializable <Transaction>();
            State           = (VMState)(byte)@struct[2].GetInteger();
        }
Beispiel #16
0
        /// <summary>
        /// Setup to run with the default options
        /// </summary>

        /// <summary>
        /// Perform one execution step on the VM
        /// </summary>
        /// <returns></returns>
        ///


        public VMState Step()
        {
            DebuggerStateCheckBeforeRun();

            core.DebugProps.RunMode        = ProtoCore.Runmode.StepIn;
            core.DebugProps.AllbreakPoints = allbreakPoints;
            lastState = RunVM(allbreakPoints);
            return(lastState);
        }
Beispiel #17
0
 protected override Action GetCompleteAction(VMState state)
 {
     return(() => {
         foreach (SamplingVM sampling in Samplings)
         {
             sampling.GenerateCollector();
         }
     });
 }
Beispiel #18
0
 public override void DragStart(List <VMPoint> clickedPoints)
 {
     if (!clickedPoints.Contains(_origin))
     {
         return;
     }
     _state = VMState.Down;
     Editor.Instance.CaptureAltPresses = true;
 }
Beispiel #19
0
        public override VMState SaveState()
        {
            VMState state = new VMState();

            if (SelectedControlConstructScheme != null)
            {
                state.State1 = SelectedControlConstructScheme.Id;
            }
            return(state);
        }
Beispiel #20
0
        public override VMState SaveState()
        {
            VMState state = new VMState();

            if (SelectedBook != null)
            {
                state.State1 = SelectedBook.Id;
            }
            return(state);
        }
Beispiel #21
0
 public override void DragMove(Coordinate distance)
 {
     if (_state == VMState.None)
     {
         return;
     }
     _state = VMState.Moving;
     // Move the origin point by the delta value
     _origin.Move(distance);
 }
Beispiel #22
0
 public override void DragEnd()
 {
     if (_state == VMState.Moving)
     {
         if (AutomaticallyMerge()) CheckMergedVertices();
         else MainTool.SetDirty(true, true);
     }
     _state = VMState.None;
     Editor.Instance.CaptureAltPresses = false;
 }
Beispiel #23
0
        public void StepOut()
        {
            State &= ~VMState.BREAK;
            int c = InvocationStack.Count;

            while (!State.HasFlag(VMState.HALT) && !State.HasFlag(VMState.FAULT) && !State.HasFlag(VMState.BREAK) && InvocationStack.Count >= c)
            {
                StepInto();
            }
        }
Beispiel #24
0
 protected override void Reload(VMState state)
 {
     if (state != null)
     {
         SelectedDataFile = EDOUtils.Find(dataFiles, state.State1);
     }
     if (SelectedDataFile == null)
     {
         SelectedDataFile = EDOUtils.GetFirst(dataFiles);
     }
 }
Beispiel #25
0
 protected override void Reload(VMState state)
 {
     if (state != null)
     {
         SelectedVariableItem = EDOUtils.Find(variables, state.State1);
     }
     if (SelectedVariableItem == null || !Variables.Contains(SelectedVariable))
     {
         SelectedVariableItem = EDOUtils.GetFirst <VariableVM>(variables);
     }
 }
Beispiel #26
0
 protected override void Reload(VMState state)
 {
     if (state != null)
     {
         SelectedItem = EDOUtils.Find(fundingInfos, state.State1);
     }
     if (SelectedItem == null)
     {
         SelectedItem = fundingInfos.FirstOrNull();
     }
 }
Beispiel #27
0
 protected override void Reload(VMState state)
 {
     if (state != null)
     {
         SelectedControlConstructScheme = EDOUtils.Find(ControlConstructSchemes, state.State1);
     }
     if (SelectedControlConstructScheme == null)
     {
         SelectedControlConstructScheme = ControlConstructSchemes.FirstOrNull();
     }
 }
Beispiel #28
0
        public override void DragMove(Coordinate distance)
        {
            _state = VMState.Moving;
            // Move each selected point by the delta value
            foreach (var p in MainTool.GetSelectedPoints())
            {
                p.Move(distance);
            }

            //MainTool.SetDirty(false, false);
        }
Beispiel #29
0
        internal VM(Instruction[] program, Body body, object[] parameters)
        {
            _instructions = program;

            Ip         = 0;
            State      = VMState.Next;
            Stack      = new Stack();
            Locals     = new LocalStorage();
            VMBody     = body;
            Parameters = parameters;
        }
Beispiel #30
0
        public override void DragMove(Coordinate distance)
        {
            _state = VMState.Moving;
            // Move each selected point by the delta value
            foreach (var p in MainTool.GetSelectedPoints())
            {
                p.Move(distance);
            }

            //MainTool.SetDirty(false, false);
        }
Beispiel #31
0
 protected override void Reload(VMState state)
 {
     if (state != null)
     {
         selectedSamplingItem = EDOUtils.Find(Samplings, state.State1);
     }
     if (selectedSamplingItem == null)
     {
         selectedSamplingItem = Samplings.FirstOrNull();
     }
 }
Beispiel #32
0
 protected override void Reload(VMState state)
 {
     if (state != null)
     {
         SelectedCodeScheme = EDOUtils.Find(codeSchemes, state.State1);
     }
     if (SelectedCodeScheme == null)
     {
         SelectedCodeScheme = EDOUtils.GetFirst(codeSchemes);
     }
 }
Beispiel #33
0
        private VMState RunVM(List <Instruction> breakPoints)
        {
            //Get the next available location and set a break point
            //Unset the break point at the current location

            Instruction currentInstr = null; // will be instantialized when a proper breakpoint is reached
            VMState     vms          = null;

            try
            {
                if (executionsuspended)
                {
                    core.NotifyExecutionEvent(ProtoCore.ExecutionStateEventArgs.State.kExecutionResume);
                }

                Execute(core.DebugProps.DebugEntryPC, breakPoints);
                isEnded = true; // the script has ended smoothly,
            }
            catch (ProtoCore.Exceptions.DebugHalting)
            {
                if (core.CurrentExecutive == null) //This was before the VM was properly started
                {
                    return(null);
                }
                currentInstr = GetCurrentInstruction(); // set the current instruction to the current breakpoint instruction
                core.NotifyExecutionEvent(ProtoCore.ExecutionStateEventArgs.State.kExecutionBreak);
                executionsuspended = true;
            }
            catch (ProtoCore.Exceptions.EndOfScript)
            {
                isEnded = true;
            }
            finally
            {
                ExecutionMirror execMirror = new ProtoCore.DSASM.Mirror.ExecutionMirror(core.CurrentExecutive.CurrentDSASMExec, core);
                vms         = new VMState(execMirror, core);
                vms.isEnded = isEnded;
                ProtoCore.CodeModel.CodePoint start = new ProtoCore.CodeModel.CodePoint();
                ProtoCore.CodeModel.CodePoint end   = new ProtoCore.CodeModel.CodePoint();

                if (currentInstr != null) // equal to null means that the whole script has ended, reset the cursor
                {
                    start = InstructionToBeginCodePoint(currentInstr);
                    end   = InstructionToEndCodePoint(currentInstr);
                }
                CurrentInstruction = currentInstr;

                vms.ExecutionCursor = new ProtoCore.CodeModel.CodeRange {
                    StartInclusive = start, EndExclusive = end
                };
            }

            return(vms);
        }
 public void Execute(Action <ExecutionEngine> onStep = null)
 {
     State &= ~VMState.BREAK;
     while (!State.HasFlag(VMState.HALT) && !State.HasFlag(VMState.FAULT) && !State.HasFlag(VMState.BREAK))
     {
         if (onStep != null)
         {
             onStep(this);
         }
         StepInto();
     }
 }
Beispiel #35
0
 public override void ToolSelected(bool preventHistory)
 {
     _state = VMState.None;
     _originals = MainTool.Points.ToDictionary(x => x, x => x.Coordinate);
     ResetOrigin(null);
 }
Beispiel #36
0
 public override void MouseClick(ViewportBase viewport, ViewportEvent e)
 {
     _state = VMState.None;
 }
Beispiel #37
0
 public override void ToolDeselected(bool preventHistory)
 {
     _state = VMState.None;
     Mediator.UnsubscribeAll(this);
 }
Beispiel #38
0
 public override void ToolSelected(bool preventHistory)
 {
     _state = VMState.None;
     UpdateSplitEnabled();
     Mediator.Subscribe(HotkeysMediator.VMSplitFace, this);
 }
Beispiel #39
0
 public override void DragStart(List<VMPoint> clickedPoints)
 {
     _state = VMState.Down;
     Editor.Instance.CaptureAltPresses = true;
 }
Beispiel #40
0
        private VMState RunVM(List<Instruction> breakPoints)
        {
            //Get the next available location and set a break point
            //Unset the break point at the current location
            Instruction currentInstr = null; // will be instantialized when a proper breakpoint is reached
            VMState vms = null;
            try
            {
                if (executionsuspended)
                    runtimeCore.NotifyExecutionEvent(ProtoCore.ExecutionStateEventArgs.State.kExecutionResume);

                Execute(runtimeCore.DebugProps.DebugEntryPC, breakPoints);
                isEnded = true; // the script has ended smoothly, 
            }
            catch (ProtoCore.Exceptions.DebugHalting)
            {
                if (runtimeCore.CurrentExecutive == null) //This was before the VM was properly started
                    return null;
                currentInstr = GetCurrentInstruction(); // set the current instruction to the current breakpoint instruction
                runtimeCore.NotifyExecutionEvent(ProtoCore.ExecutionStateEventArgs.State.kExecutionBreak);
                executionsuspended = true;
            }
            catch (ProtoCore.Exceptions.EndOfScript)
            {
                isEnded = true;
            }
            finally
            {
                ExecutionMirror execMirror = new ProtoCore.DSASM.Mirror.ExecutionMirror(runtimeCore.CurrentExecutive.CurrentDSASMExec, runtimeCore);
                vms = new VMState(execMirror, core);
                vms.isEnded = isEnded;
                ProtoCore.CodeModel.CodePoint start = new ProtoCore.CodeModel.CodePoint();
                ProtoCore.CodeModel.CodePoint end = new ProtoCore.CodeModel.CodePoint();

                if (currentInstr != null) // equal to null means that the whole script has ended, reset the cursor
                {
                    start = InstructionToBeginCodePoint(currentInstr);
                    end = InstructionToEndCodePoint(currentInstr);
                }
                CurrentInstruction = currentInstr;

                vms.ExecutionCursor = new ProtoCore.CodeModel.CodeRange { StartInclusive = start, EndExclusive = end };
            }

            return vms;

        }
Beispiel #41
0
        public void Shutdown()
        {
            if (lastState != null)
                lastState.Invalidate();

            try
            {
                //core.heap.Free();
            }
            catch (Exception)
            { }

            //Drop the VM state objects so they can be GCed
            runtimeCore.NotifyExecutionEvent(ProtoCore.ExecutionStateEventArgs.State.kExecutionEnd);
            lastState = null;
            core = null;

        }
Beispiel #42
0
        /// <summary>
        /// Setup to run with the default options
        /// </summary>

        /// <summary>
        /// Perform one execution step on the VM
        /// </summary>
        /// <returns></returns>
        /// 


        public VMState Step()
        {
            DebuggerStateCheckBeforeRun();

            runtimeCore.DebugProps.RunMode = ProtoCore.Runmode.StepIn;
            runtimeCore.DebugProps.AllbreakPoints = allbreakPoints;
            lastState =  RunVM(allbreakPoints);
            return lastState;
        }
Beispiel #43
0
 public override void DragStart(List<VMPoint> clickedPoints)
 {
     if (!clickedPoints.Contains(_origin)) return;
     _state = VMState.Down;
     Editor.Instance.CaptureAltPresses = true;
 }
Beispiel #44
0
 public override void ToolDeselected()
 {
     _state = VMState.None;
     _originals = null;
     Mediator.UnsubscribeAll(this);
 }
Beispiel #45
0
 public override void DragEnd()
 {
     _state = VMState.None;
     Editor.Instance.CaptureAltPresses = false;
 }
Beispiel #46
0
 public override void ToolSelected()
 {
     _state = VMState.None;
     _originals = MainTool.Points.ToDictionary(x => x, x => x.Coordinate);
     DocumentGridSpacingChanged(Document.Map.GridSpacing);
     ResetOrigin(null);
     Mediator.Subscribe(EditorMediator.DocumentGridSpacingChanged, this);
 }