Esempio n. 1
0
        /// <summary>
        /// Get Stack arguments for mulitples frames
        /// </summary>
        /// <param name="printValues"></param>
        /// <param name="threadId"></param>
        /// <param name="lowFrameLevel"></param>
        /// <param name="hiFrameLevel"></param>
        /// <returns>This returns an array of results of frames, which contains a level and an args array. </returns>
        public virtual async Task <TupleValue[]> StackListArguments(PrintValues printValues, int threadId, uint lowFrameLevel, uint hiFrameLevel)
        {
            string  cmd = string.Format(@"-stack-list-arguments {0} {1} {2}", (int)printValues, lowFrameLevel, hiFrameLevel);
            Results argumentsResults = await ThreadCmdAsync(cmd, ResultClass.done, threadId);

            return(argumentsResults.Find <ListValue>("stack-args").IsEmpty()
                ? new TupleValue[0]
                : argumentsResults.Find <ResultListValue>("stack-args").FindAll <TupleValue>("frame"));
        }
Esempio n. 2
0
        public async Task <TupleValue[]> DataListRegisterValues(int threadId)
        {
            string  command = "-data-list-register-values x";
            Results results = await ThreadCmdAsync(command, ResultClass.done, threadId);

            return(results.Find <ValueListValue>("register-values").AsArray <TupleValue>());
        }
Esempio n. 3
0
        public async Task <string[]> DataListRegisterNames()
        {
            string  cmd     = "-data-list-register-names";
            Results results = await _debugger.CmdAsync(cmd, ResultClass.done);

            return(results.Find <ValueListValue>("register-names").AsStrings);
        }
Esempio n. 4
0
        public async Task <TupleValue[]> StackListFrames(int threadId, uint lowFrameLevel, uint highFrameLevel = 1000)
        {
            string  command = string.Format(@"-stack-list-frames {0} {1}", lowFrameLevel, highFrameLevel);
            Results results = await ThreadCmdAsync(command, ResultClass.done, threadId);

            return(results.Find <ResultListValue>("stack").FindAll <TupleValue>("frame"));
        }
Esempio n. 5
0
        /// <summary>
        /// Get variables for the given frame
        /// </summary>
        /// <param name="printValues"></param>
        /// <param name="threadId"></param>
        /// <param name="frameLevel"></param>
        /// <param name="resultClass"></param>
        /// <returns>Returns an array of results for variables</returns>
        public async Task <ValueListValue> StackListVariables(PrintValues printValues, int threadId, uint frameLevel)
        {
            string cmd = string.Format(@"-stack-list-variables {0}", (int)printValues);

            Results variablesResults = await ThreadFrameCmdAsync(cmd, ResultClass.done, threadId, frameLevel);

            return(variablesResults.Find <ValueListValue>("variables"));
        }
Esempio n. 6
0
        /// <summary>
        /// Get locals for the give frame
        /// </summary>
        /// <param name="printValues">0 for no values, 1 for all values, 2 for simple values</param>
        /// <param name="threadId"></param>
        /// <param name="frameLevel"></param>
        /// <returns></returns>
        public async Task <ResultValue> StackListLocals(PrintValues printValues, int threadId, uint frameLevel)
        {
            string cmd = string.Format(@"-stack-list-locals {0}", (int)printValues);

            Results localsResults = await ThreadFrameCmdAsync(cmd, ResultClass.done, threadId, frameLevel);

            return(localsResults.Find("locals"));
        }
Esempio n. 7
0
        private async void OnStopped(Results results)
        {
            string reason = results.TryFindString("reason");

            if (reason.StartsWith("exited"))
            {
                if (IsLocalGdbAttach())
                {
                    CmdExitAsync();
                }

                this.ProcessState = ProcessState.Exited;
                if (ProcessExitEvent != null)
                {
                    ProcessExitEvent(this, new ResultEventArgs(results));
                }
                return;
            }

            //if this is an exception reported from LLDB, it will not currently contain a frame object in the MI
            //if we don't have a frame, check if this is an excpetion and retrieve the frame
            if (!results.Contains("frame") &&
                string.Compare(reason, "exception-received", StringComparison.OrdinalIgnoreCase) == 0
                )
            {
                //get the info for the current frame
                Results frameResult = await MICommandFactory.StackInfoFrame();

                //add the frame to the stopping results
                results.Add("frame", frameResult.Find("frame"));
            }

            bool fIsAsyncBreak = MICommandFactory.IsAsyncBreakSignal(results);

            if (await DoInternalBreakActions(fIsAsyncBreak))
            {
                return;
            }

            this.ProcessState = ProcessState.Stopped;
            FlushBreakStateData();

            if (!results.Contains("frame"))
            {
                if (ModuleLoadEvent != null)
                {
                    ModuleLoadEvent(this, new ResultEventArgs(results));
                }
            }
            else if (BreakModeEvent != null)
            {
                if (fIsAsyncBreak)
                {
                    _requestingRealAsyncBreak = false;
                }
                BreakModeEvent(this, new ResultEventArgs(results));
            }
        }
Esempio n. 8
0
        public virtual async Task <TupleValue> BreakInfo(string bkptno)
        {
            Results bindResult = await _debugger.CmdAsync("-break-info " + bkptno, ResultClass.None);

            if (bindResult.ResultClass != ResultClass.done)
            {
                return(null);
            }
            var breakpointTable = bindResult.Find <TupleValue>("BreakpointTable").Find <ResultListValue>("body").FindAll <TupleValue>("bkpt");

            return(breakpointTable[0]);
        }
Esempio n. 9
0
        // In LLDB 3.5, -break-insert -f requires a string before the actual method name.
        // We use a placeholder 'on' for this.
        // Later versions do not require the 'on' keyword.
        public override async Task <bool> RequiresOnKeywordForBreakInsert()
        {
            if (!_requiresOnKeywordForBreakInsert.HasValue)
            {
                _requiresOnKeywordForBreakInsert = false;
                try
                {
                    // Test to see if -break-insert -f main works.
                    string  breakInsertMainCommand = "-break-insert -f main";
                    Results results = await _debugger.CmdAsync(breakInsertMainCommand, ResultClass.done);

                    await this.BreakDelete(results.Find("bkpt").FindString("number"));
                }
                catch (UnexpectedMIResultException)
                {
                    _requiresOnKeywordForBreakInsert = true;
                }
            }

            return(_requiresOnKeywordForBreakInsert.Value);
        }
Esempio n. 10
0
        public async Task <TupleValue[]> StackListFrames(int threadId, uint lowFrameLevel, uint highFrameLevel = 1000)
        {
            string  command = string.Format(@"-stack-list-frames {0} {1}", lowFrameLevel, highFrameLevel);
            Results results = await ThreadCmdAsync(command, ResultClass.done, threadId);

            ListValue list = results.Find <ListValue>("stack");

            if (list is ResultListValue)
            {
                // Populated stacks are converted to ResultListValue type. Return all instances of "frame={...}".
                return(((ResultListValue)list).FindAll <TupleValue>("frame"));
            }
            else if (list is ValueListValue)
            {
                // Empty stacks are converted to ValueListValue type. Just return an empty stack.
                return(new TupleValue[0]);
            }
            else
            {
                throw new MIResultFormatException("stack", results);
            }
        }
Esempio n. 11
0
        public virtual async Task <string[]> GetTargetFeatures()
        {
            Results results = await _debugger.CmdAsync("-list-target-features", ResultClass.done);

            return(results.Find <ValueListValue>("features").AsStrings);
        }