Exemplo n.º 1
0
 private void btGetVariableValue_Click(object sender, EventArgs e)
 {
     if (tvVariables.SelectedNode != null && tvVariables.SelectedNode.Tag is O2MDbgVariable)
     {
         O2MDbgUtils.showVariableValue((O2MDbgVariable)tvVariables.SelectedNode.Tag);
     }
 }
        public List <string> animateOver(int sleepInterval)
        {
            DI.log.info("Start: Animate Over");
            AnimateOnStepEvent = true;
            var instructions = new List <String> {
                lastCommandExecutionMessage
            };

            if (IsActive && !IsRunning)
            {
                while (continueAnimation())
                {
                    var stepOverThread = O2MDbgUtils.stepOver();
                    stepOverThread.Join();

                    /*execSync(O2MDbgCommands.stepOver());
                     * instructions.Add(lastCommandExecutionMessage);
                     * if (ignoreThisSignature(lastCommandExecutionMessage))
                     *  execSync(O2MDbgCommands.stepBack());
                     * else*/

                    instructions.Add(lastCommandExecutionMessage);
                    if (sleepInterval > 0)
                    {
                        Processes.Sleep(sleepInterval, false);
                    }
                }
            }
            else
            {
                DI.log.e("in animateOver either the process is not active or is running");
            }
            DI.log.info("End: Animate Over");
            return(instructions);
        }
Exemplo n.º 3
0
 private void btChangeVariableValue_Click(object sender, EventArgs e)
 {
     if (tvVariables.SelectedNode != null && tvVariables.SelectedNode.Tag is O2MDbgVariable)
     {
         O2MDbgUtils.setVariableValue((O2MDbgVariable)tvVariables.SelectedNode.Tag, tbVariableValue.Text);
     }
 }
        //HandleO2MessageOnSD.o2MessageHelper_Handle_IM_FileOrFolderSelected(o2Message);
        public static void o2KernelQueue_onMessages(IO2Message o2Message)
        {
            if (o2Message is IM_O2MdbgAction)
            {
                IM_O2MdbgAction o2MDbgAction = (IM_O2MdbgAction)o2Message;
                switch (o2MDbgAction.o2MdbgAction)
                {
                case IM_O2MdbgActions.breakEvent:
                {
                    string filename = o2MDbgAction.filename;
                    int    line     = o2MDbgAction.line;
                    DI.log.info("SOURCECODE REF -> {0} : {1})", new object[] { line, filename });
                    O2.Kernel.CodeUtils.O2Messages.fileOrFolderSelected(filename, line);
                    //HandleO2MessageOnSD.setSelectedLineNumber(filename, line);
                    break;
                }

                case IM_O2MdbgActions.debugProcessRequest:
                    O2MDbgUtils.startProcessUnderDebugger(o2MDbgAction.filename);
                    break;

                case IM_O2MdbgActions.debugMethodInfoRequest:
                    O2MDbgUtils.debugMethod(o2MDbgAction.method, o2MDbgAction.loadDllsFrom);
                    break;

                case IM_O2MdbgActions.setBreakpointOnFile:
                    O2MDbgUtils.setBreakPointOnFile(o2MDbgAction.filename, o2MDbgAction.line);
                    break;
                }
            }
        }
        public List <string> animateBack(int sleepInterval)
        {
            DI.log.info("Start: Animate Back");
            var instructions = new List <String> {
                lastCommandExecutionMessage
            };

            if (IsActive && !IsRunning)
            {
                while (continueAnimation())
                {
                    var stepOutThread = O2MDbgUtils.stepOut();
                    stepOutThread.Join();
                    //execSync(O2MDbgCommands.stepBack());

                    instructions.Add(lastCommandExecutionMessage);
                    if (sleepInterval > 0)
                    {
                        Processes.Sleep(sleepInterval, false);
                    }
                }
            }
            else
            {
                DI.log.e("in animateBack either the process is not active or is running");
            }
            DI.log.info("Stop: Animate Over");
            return(instructions);
        }
        static void ascx_Scripts_onMessages(IO2Message o2Message)
        {
            HandleO2MessageOnSD.o2MessageHelper_Handle_IM_FileOrFolderSelected(o2Message);

            if (o2Message is IM_O2MdbgAction)
            {
                var o2MDbgAction = (IM_O2MdbgAction)o2Message;
                switch (o2MDbgAction.o2MdbgAction)
                {
                case IM_O2MdbgActions.breakEvent:

                    var filename = o2MDbgAction.filename;
                    var line     = o2MDbgAction.line;
                    DI.log.info("SOURCECODE REF -> {0} : {1})", line, filename);
                    HandleO2MessageOnSD.setSelectedLineNumber(filename, line);
                    break;

                case IM_O2MdbgActions.debugProcessRequest:
                    O2MDbgUtils.startProcessUnderDebugger(o2MDbgAction.filename);
                    break;

                case IM_O2MdbgActions.debugMethodInfoRequest:
                    O2MDbgUtils.debugMethod(o2MDbgAction.method, o2MDbgAction.loadDllsFrom);
                    break;
                }
            }
        }
Exemplo n.º 7
0
 private void btExecuteOnFrame_Click(object sender, EventArgs e)
 {
     O2Thread.mtaThread(() =>
     {
         DI.log.debug("Executing: {0}", tbExecuteOnFrame.Text);
         var result = O2MDbgUtils.execute(tbExecuteOnFrame.Text);
         DI.log.debug("Execution result: {0}", (result ?? "<null>"));
     });
 }
 private void btAttachToSelectedProcess_Click(object sender, EventArgs e)
 {
     if (lvManagedProcesses.SelectedItems.Count == 1)
     {
         var processItToAttach = lvManagedProcesses.SelectedItems[0].SubItems[0].Text;
         O2MDbgUtils.attachToProcess(processItToAttach);
         updateGuiEnabledControlState();
     }
 }
        private void btStartProcess_Click(object sender, EventArgs e)
        {
            var executableToStart = tbExecutableToStartAndDebug.Text;

            btStartProcess.Enabled = false;
            O2MDbgUtils.startProcessUnderDebugger(executableToStart);
            updateGuiEnabledControlState();

            Processes.Sleep(1000); // wait a bit before reenabling this button
            btStartProcess.Enabled = true;
        }
Exemplo n.º 10
0
        public void test_startSampleFileUnderDebuggerAndStepIntoIt()
        {
            // before we start the process we need to set the callback for global O2Messages (so that we pick up the OnBreakpoint message)
            PublicDI.o2MessageQueue.onMessages += o2Message =>
            {
                DI.log.info("message received: {0}", o2Message.messageText);
                if (o2Message is IM_O2MdbgAction)
                {
                    var o2MDbgAction = (IM_O2MdbgAction)o2Message;
                    if (o2MDbgAction.o2MdbgAction == IM_O2MdbgActions.breakEvent)
                    {
                        var filename = o2MDbgAction.filename;
                        var line     = o2MDbgAction.line;
                        DI.log.info("SOURCECODE REF -> {0} : {1})", line, filename);
                        setSelectedLineNumber(filename, line);
                    }
                }
            };

            // start process under debuggger
            var startThread = O2MDbgUtils.startProcessUnderDebugger(assemblyToExecute);

            // wait for it completes execution
            startThread.Join();
            Assert.That(O2MDbgUtils.IsActive(), "Debugger should be active");
            Assert.That(false == O2MDbgUtils.IsRunning(), "Debugger should Not be running");

            var selectedLine = getSelectedLineNumber();

            O2MDbgUtils.stepIntoAnimated();

            /*      Assert.That(selectedLine != currentSelectedLine,
             *                "After debugger started the selectedLine != currentSelectedLine: " + selectedLine + " != " +
             *                currentSelectedLine);*/



            //    Processes.Sleep(3000);
            //O2AscxGUI.invokeOnAscxControl(ascxScriptControl,)
            O2AscxGUI.logInfo("all ready");
        }
        internal void raiseOnBreakEvent(O2MDbgCurrentLocation o2MDbgCurrentLocation)
        {
            if (registeredOnBreakEventCallbacks == null)
            {
                registeredOnBreakEventCallbacks = new Dictionary <string, List <Func <O2MDbgCurrentLocation, Dictionary <string, O2MDbgVariable>, bool> > >();
            }
            Callbacks.raiseRegistedCallbacks(onBreakEvent);
            // make sure all breakpoints are registed
            var activeBreakPoints = BreakPoints.getBreakPointsAsStringList();

            foreach (var breakpointSignature in registeredOnBreakEventCallbacks.Keys)
            {
                if (false == activeBreakPoints.Contains(breakpointSignature))
                {
                    BreakPoints.addBreakPoint(breakpointSignature);
                }
            }
            // check if we need to invoke a callback
            //if (o2MDbgCurrentLocation.hasSourceCodeDetails)
            //{
            var currentLocationString = o2MDbgCurrentLocation.ToString();

            if (registeredOnBreakEventCallbacks.ContainsKey(currentLocationString))
            {
                Dictionary <string, O2MDbgVariable> variablesDictionary = DI.o2MDbg.sessionData.getVariablesDictionary();
                foreach (var callback in registeredOnBreakEventCallbacks[currentLocationString])
                {
                    if (callback(o2MDbgCurrentLocation, variablesDictionary))
                    {
                        // means execution is supposed to continue
                        O2MDbgUtils.continueAttachedProjet();
                        return;
                    }
                }
            }
            if (DI.o2MDbg.AutoContinueOnBreakPointEvent)
            {
                O2MDbgUtils.continueAttachedProjet();
            }
        }
        public List <string> animateInto(int sleepInterval)
        {
            DI.log.info("Start: Animate Into");
            AnimateOnStepEvent = true;
            var instructions = new List <String> {
                lastCommandExecutionMessage
            };

            if (IsActive && !IsRunning)
            {
                while (continueAnimation())
                {
                    // if (ignoreThisSignature(lastCommandExecutionMessage))
                    //     execSync(O2MDbgCommands.stepBack());
                    // else

                    //execSync(O2MDbgCommands.stepInto());
                    var threadStepInto = O2MDbgUtils.stepInto();
                    threadStepInto.Join();

                    //var caller = shell.Debugger.Processes.Active.Threads.Active.CurrentFrame.CorFrame.Caller;
                    //var callee = shell.Debugger.Processes.Active.Threads.Active.CurrentFrame.CorFrame.Callee;
                    // don't step into code that we don't have the debug symbols for (namely the .Net framework)

                    instructions.Add(lastCommandExecutionMessage);
                    if (sleepInterval > 0)
                    {
                        Processes.Sleep(sleepInterval, false);
                    }
                }
            }
            else
            {
                DI.log.e("in animateInto either the process is not active or is running");
            }
            DI.log.info("Stop: Animate Into");
            return(instructions);
        }