Ejemplo n.º 1
0
        private void HandleThreadGroupStarted(Results results)
        {
            string idString  = results.FindString("id");
            string pidString = results.FindString("pid");

            lock (_debuggeePids)
            {
                _debuggeePids.Add(idString, Int32.Parse(pidString, CultureInfo.InvariantCulture));
            }
        }
Ejemplo n.º 2
0
        public async Task <string> VarInfoPathExpression(string variableName)
        {
            string  command = string.Format("-var-info-path-expression {0}", variableName);
            Results results = await _debugger.CmdAsync(command, ResultClass.done);

            return(results.FindString("path_expr"));
        }
Ejemplo n.º 3
0
        public async Task <string> VarAssign(string variableName, string expression)
        {
            string  command = string.Format("-var-assign {0} \"{1}\"", variableName, expression);
            Results results = await _debugger.CmdAsync(command, ResultClass.done);

            return(results.FindString("value"));
        }
Ejemplo n.º 4
0
        public async Task <string> DataEvaluateExpression(string expr, int threadId, uint frame)
        {
            string  command = "-data-evaluate-expression \"" + expr + "\"";
            Results results = await ThreadFrameCmdAsync(command, ResultClass.None, threadId, frame);

            return(results.FindString("value"));
        }
Ejemplo n.º 5
0
        public virtual async Task <string> VarAssign(string variableName, string expression, int threadId, uint frameLevel)
        {
            string  command = string.Format(CultureInfo.InvariantCulture, "-var-assign {0} \"{1}\"", variableName, expression);
            Results results = await _debugger.CmdAsync(command, ResultClass.done);

            return(results.FindString("value"));
        }
Ejemplo n.º 6
0
        private void HandleThreadGroupStarted(Results results)
        {
            string threadGroupId = results.FindString("id");
            string pidString     = results.FindString("pid");

            int pid = Int32.Parse(pidString, CultureInfo.InvariantCulture);

            // Ignore pid 0 due to spurious thread group created event on iOS (lldb).
            // On android the scheduler runs as pid 0, but that process cannot currently be debugged anyway.
            if (pid != 0)
            {
                lock (_debuggeePids)
                {
                    _debuggeePids.Add(threadGroupId, pid);
                }
            }
        }
Ejemplo n.º 7
0
        public async Task <string> VarShowAttributes(string variableName)
        {
            string  command = string.Format("-var-show-attributes {0}", variableName);
            Results results = await _debugger.CmdAsync(command, ResultClass.done);

            string attribute = string.Empty;

            // The docs say that this should be 'status' but Android version of Gdb-mi uses 'attr'
            if (results.Contains("attr"))
            {
                attribute = results.FindString("attr");
            }
            else
            {
                attribute = results.FindString("status");
            }

            return(attribute);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Assigns the value of an expression to a variable.
        /// Since LLDB only accepts assigning values to variables, the expression may need to be evaluated.
        /// However, since the result of evaluating an expression in LLDB can return some extra information:
        /// e.g., 'a' --> 97 'a'. We don't want to assign the value "97 'a'". Instead, we first try
        /// assigning what the user passed, only falling back to evaluation if the first assignment fails.
        /// </summary>
        public async override Task <string> VarAssign(string variableName, string expression, int threadId, uint frameLevel)
        {
            try
            {
                return(await base.VarAssign(variableName, expression, threadId, frameLevel));
            }
            catch (UnexpectedMIResultException)
            {
                Results results = await VarCreate(expression, threadId, frameLevel, 0, ResultClass.done);

                string value = results.FindString("value");
                return(await base.VarAssign(variableName, value, threadId, frameLevel));
            }
        }
Ejemplo n.º 9
0
        public override void DecodeExceptionReceivedProperties(Results miExceptionResult, out Guid?exceptionCategory, out ExceptionBreakpointState state)
        {
            string category = miExceptionResult.FindString("exception-category");

            if (category == "mda")
            {
                exceptionCategory = s_exceptionCategory_MDA;
            }
            else
            {
                Debug.Assert(category == "clr");
                exceptionCategory = s_exceptionCategory_CLR;
            }

            string stage = miExceptionResult.FindString("exception-stage");

            switch (stage)
            {
            case "throw":
                state = ExceptionBreakpointState.BreakThrown;
                break;

            case "user-unhandled":
                state = ExceptionBreakpointState.BreakUserHandled;
                break;

            case "unhandled":
                state = ExceptionBreakpointState.None;
                break;

            default:
                Debug.Fail("Unknown exception-stage value");
                state = ExceptionBreakpointState.None;
                break;
            }
        }
Ejemplo n.º 10
0
            internal void OnComplete(Results results, MICommandFactory commandFactory)
            {
                if (_expectedResultClass != ResultClass.None && _expectedResultClass != results.ResultClass)
                {
                    string miError = null;
                    if (results.ResultClass == ResultClass.error)
                    {
                        miError = results.FindString("msg");
                    }

                    _completionSource.SetException(new UnexpectedMIResultException(commandFactory.Name, this.Command, miError));
                }
                else
                {
                    _completionSource.SetResult(results);
                }
            }