Exemple #1
0
        private bool CheckBreakpoint(int handle)
        {
            BreakEventInfo binfo;

            if (!breakpoints.TryGetValue(handle, out binfo))
            {
                return(true);
            }

            Breakpoint bp = (Breakpoint)binfo.BreakEvent;

            if (!string.IsNullOrEmpty(bp.ConditionExpression) && bp.BreakIfConditionChanges)
            {
                // Update the condition expression
                GdbCommandResult res = RunCommand("-data-evaluate-expression", Escape(bp.ConditionExpression));
                string           val = res.GetValue("value");
                RunCommand("-break-condition", handle.ToString(), "(" + bp.ConditionExpression + ") != " + val);
            }

            if (!string.IsNullOrEmpty(bp.TraceExpression) && bp.HitAction == HitAction.PrintExpression)
            {
                GdbCommandResult res = RunCommand("-data-evaluate-expression", Escape(bp.TraceExpression));
                string           val = res.GetValue("value");
                NotifyBreakEventUpdate(binfo, 0, val);
                return(false);
            }
            return(true);
        }
Exemple #2
0
        private void FireTargetEvent(TargetEventType type, ResultData curFrame, BreakEvent breakEvent = null)
        {
            UpdateHitCountData();

            TargetEventArgs args = new TargetEventArgs(type);

            if (type != TargetEventType.TargetExited)
            {
                GdbCommandResult res = RunCommand("-stack-info-depth");
                int fcount           = int.Parse(res.GetValue("depth"));

                GdbBacktrace bt = new GdbBacktrace(this, activeThread, fcount, curFrame);
                args.Backtrace  = new Backtrace(bt);
                args.Thread     = GetThread(activeThread);
                args.BreakEvent = breakEvent;
            }

            if (_suppressEvents && type == TargetEventType.TargetStopped)
            {
                args.IsStopEvent = true;
                TargetStoppedWhenSuppressed?.Invoke(this, args);
            }
            else
            {
                OnTargetEvent(args);
            }
        }
Exemple #3
0
        private ObjectValue CreateVarObject(string exp)
        {
            try
            {
                session.SelectThread(threadId);
                exp = exp.Replace("\"", "\\\"");
                GdbCommandResult res = session.RunCommand("-var-create", "-", "*", "\"" + exp + "\"");

                if (res.Status == CommandStatus.Done)
                {
                    string vname  = res.GetValue("name");
                    var    result = CreateObjectValue(exp, res);

                    session.RegisterTempVariableObject(vname, result);

                    return(result);
                }
                else
                {
                    return(ObjectValue.CreateUnknown(exp));
                }
            }
            catch
            {
                return(ObjectValue.CreateUnknown(exp));
            }
        }
Exemple #4
0
        protected override Backtrace OnGetThreadBacktrace(long processId, long threadId)
        {
            ResultData       data = SelectThread(threadId);
            GdbCommandResult res  = RunCommand("-stack-info-depth");
            int          fcount   = int.Parse(res.GetValue("depth"));
            GdbBacktrace bt       = new GdbBacktrace(this, threadId, fcount, data != null ? data.GetObject("frame") : null);

            return(new Backtrace(bt));
        }
Exemple #5
0
        protected override void OnFinish()
        {
            SelectThread(activeThread);
            GdbCommandResult res = RunCommand("-stack-info-depth", "2");

            if (res.GetValue("depth") == "1")
            {
                RunCommand("-exec-continue");
            }
            else
            {
                RunCommand("-stack-select-frame", "0");
                RunCommand("-exec-finish");
            }
        }