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); }
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); } }
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)); } }
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)); }
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"); } }