public MonoDSymbolResolver(IObjectValueSource objectValueSource, DEW.DBGEngine engine) { this.ObjectValueSource = objectValueSource; this.Engine = engine; }
public DDebugBacktrace(DDebugSession session, long threadId, DEW.DBGEngine engine) { this.session = session; this.Engine = engine; fcount = engine.CallStack.Length; this.threadId = threadId; if (firstFrame != null) this.firstFrame = CreateFrame(Engine.CallStack[0]); }
public PlainDbgEngBasedBacktrace(DDebugSession session, long threadId, DEW.DBGEngine engine) { BacktraceHelper = new DLocalExamBacktrace(this); this.session = session; this.Engine = engine; fcount = engine.CallStack.Length; this.threadId = threadId; if (firstFrame != null) this.firstFrame = CreateFrame(Engine.CallStack[0]); }
public DebugStackFrameMarker(TextMarkerService svc, DebugEngineWrapper.StackFrame frm, int text_offset) : base(svc, text_offset, true) { Frame = frm; if (frm.FrameNumber < 1) BackgroundColor = Colors.Yellow; else BackgroundColor = Colors.Green; MarkerType = TextMarkerType.None; }
public static DebugStackFrameMarker Create(TextMarkerService svc, DebugEngineWrapper.StackFrame frm) { string fn; uint ln; ulong off = frm.InstructionOffset; if (Engine.Symbols.GetLineByOffset(off, out fn, out ln)) { var text_off = svc.Editor.Document.GetOffset((int)ln, 0); var m = new DebugStackFrameMarker(svc, frm, text_off); m.Redraw(); return m; } return null; }
private AbstractType[] ResolveParentSymbol(DEW.DebugScopedSymbol parentsymbol, ResolutionContext ctxt) { if (parentsymbol.Parent != null) { return TypeDeclarationResolver.ResolveFurtherTypeIdentifier(parentsymbol.Name, ResolveParentSymbol(parentsymbol.Parent, ctxt), ctxt, null); } else { return TypeDeclarationResolver.ResolveIdentifier(parentsymbol.Name, ctxt, null); } }
public ObjectValue Resolve(ulong offset, string symbolname, string typename, string val, DEW.DebugScopedSymbol parentsymbol) { DModule module; int codeLine; INode variableNode = null; // Search currently scoped module string file = ""; uint line = 0; Engine.Symbols.GetLineByOffset(Engine.CurrentInstructionOffset, out file, out line); codeLine = (int)line; if (string.IsNullOrWhiteSpace(file)) return null; AbstractDProject dproj = null; module = GetFileSyntaxTree(file, out dproj); // If syntax tree built, search the variable location if (module != null) { var ed = Resolver.DResolverWrapper.CreateEditorData(IdeApp.Workbench.ActiveDocument); var ctxt = ResolutionContext.Create(ed, false); CodeCompletion.DoTimeoutableCompletionTask(null, ctxt, () => { ctxt.Push(module, new CodeLocation(0, codeLine)); AbstractType[] res; if (parentsymbol != null) { var parentres = ResolveParentSymbol(parentsymbol, ctxt); res = TypeDeclarationResolver.ResolveFurtherTypeIdentifier(symbolname, parentres, ctxt, null); } else { res = TypeDeclarationResolver.ResolveIdentifier(symbolname, ctxt, null); } if (res != null && res.Length > 0 && res[0] is DSymbol) { variableNode = (res[0] as DSymbol).Definition; } }); } // Set type string string _typeString = typename; if (variableNode != null) { var t = variableNode.Type; if (t != null) _typeString = t.ToString(); } // Set value string string _valueString = val; ObjectValueFlags flags = ObjectValueFlags.Variable; if (variableNode != null) { ITypeDeclaration curValueType = variableNode.Type; if (curValueType != null) { if (!IsBasicType(curValueType)) { if (_typeString == "string") //TODO: Replace this by searching the alias definition in the cache curValueType = new ArrayDecl() { InnerDeclaration = new DTokenDeclaration(DTokens.Char) }; else if (_typeString == "wstring") curValueType = new ArrayDecl() { InnerDeclaration = new DTokenDeclaration(DTokens.Wchar) }; else if (_typeString == "dstring") curValueType = new ArrayDecl() { InnerDeclaration = new DTokenDeclaration(DTokens.Dchar) }; if (IsArray(curValueType)) { flags = ObjectValueFlags.Array; var clampDecl = curValueType as ArrayDecl; var valueType = clampDecl.InnerDeclaration; if (valueType is DTokenDeclaration) { bool IsString = false; uint elsz = 0; var realType = DetermineArrayType((valueType as DTokenDeclaration).Token, out elsz, out IsString); var arr = Engine.Symbols.ReadArray(offset, realType, elsz); if (arr != null) _valueString = BuildArrayContentString(arr, IsString); } } else { flags = ObjectValueFlags.Object; } } } } return ObjectValue.CreatePrimitive(ObjectValueSource, new ObjectPath(symbolname), _typeString, new EvaluationResult(_valueString), flags); }
public ObjectValue Resolve(DEW.DebugScopedSymbol symbol) { return Resolve(symbol.Offset, symbol.Name, symbol.TypeName, symbol.TextValue, symbol.Parent); }
DEW.DebugScopedSymbol FindScopedSymbol(string symbolname, DEW.DebugScopedSymbol[] symbols) { List<string> path = new List<string>(symbolname.Split('.')); for (uint i = 0; i < symbols.Length; i++) { if (path[0] == symbols[i].Name) { path.RemoveAt(0); if (path.Count > 0) return FindScopedSymbol(string.Join(".", path.ToArray()), symbols[i].Children); else return symbols[i]; } } return null; }
ObjectValue CreateObjectValue(string name, DebugEngineWrapper.DebugScopedSymbol symbol) { string vname = symbol.Name; string typeName = symbol.TypeName; string value = symbol.TextValue; int nchild = (int)symbol.ChildrenCount; ObjectValue val = symbolResolver.Resolve(symbol.Offset, vname, typeName, value, symbol.Parent); if (val == null) { ObjectValueFlags flags = ObjectValueFlags.Variable; // There can be 'public' et al children for C++ structures if (typeName == null) typeName = "none"; val = ObjectValue.CreatePrimitive(this, new ObjectPath(vname), typeName, new EvaluationResult(value), flags); val.Name = name; } return val; }
StackFrame CreateFrame(DEW.StackFrame frameData) { string fn; uint ln; ulong off = frameData.InstructionOffset; Engine.Symbols.GetLineByOffset(off, out fn, out ln); /* SourceLocation loc = new SourceLocation (func ?? "?", sfile, line); long addr; if (!string.IsNullOrEmpty (sadr)) addr = long.Parse (sadr.Substring (2), NumberStyles.HexNumber); else addr = 0; */ string methodName = Engine.Symbols.GetNameByOffset(off); SourceLocation loc = new SourceLocation(methodName, fn, (int)ln); return new StackFrame((long)off, loc, "Native"); /* string lang = "Native"; string func = frameData.GetValue ("func"); string sadr = frameData.GetValue ("addr"); if (func == "??" && session.IsMonoProcess) { // Try to get the managed func name try { ResultData data = session.RunCommand ("-data-evaluate-expression", "mono_pmip(" + sadr + ")"); string val = data.GetValue ("value"); if (val != null) { int i = val.IndexOf ('"'); if (i != -1) { func = val.Substring (i).Trim ('"',' '); lang = "Mono"; } } } catch { } } int line = -1; string sline = frameData.GetValue ("line"); if (sline != null) line = int.Parse (sline); string sfile = frameData.GetValue ("fullname"); if (sfile == null) sfile = frameData.GetValue ("file"); if (sfile == null) sfile = frameData.GetValue ("from"); SourceLocation loc = new SourceLocation (func ?? "?", sfile, line); long addr; if (!string.IsNullOrEmpty (sadr)) addr = long.Parse (sadr.Substring (2), NumberStyles.HexNumber); else addr = 0; return new StackFrame (addr, loc, lang); */ }
public DObjectValue(DEW.DebugScopedSymbol symb, PlainDbgEngBasedBacktrace backtrace) { this.Backtrace = backtrace; Symbol = symb; /*var type = symb.TypeName.Replace('@','.'); if (type.StartsWith("class")) type = type.Substring(5); if (!string.IsNullOrWhiteSpace(type)) DType = DParser.ParseBasicType(type);*/ }
public BreakPointWrapper(BreakEventInfo eventInfo, DebugEngineWrapper.BreakPoint breakpoint) { EventInfo = eventInfo; Breakpoint = breakpoint; }
ObjectValue CreateObjectValue(string name, DebugEngineWrapper.DebugScopedSymbol symbol) { string vname = symbol.Name; string typeName = symbol.TypeName; string value = symbol.TextValue; int nchild = (int) symbol.ChildrenCount; ObjectValue val; ObjectValueFlags flags = ObjectValueFlags.Variable; // There can be 'public' et al children for C++ structures if (typeName == null) typeName = "none"; val = ObjectValue.CreatePrimitive(this, new ObjectPath(vname), typeName, new EvaluationResult(value), flags); val.Name = name; return val; /* if (typeName.EndsWith ("]")) { val = ObjectValue.CreateArray (this, new ObjectPath (vname), typeName, nchild, flags, null); } else if (value == "{...}" || typeName.EndsWith ("*") || nchild > 0) { val = ObjectValue.CreateObject (this, new ObjectPath (vname), typeName, value, flags, null); } else { val = ObjectValue.CreatePrimitive (this, new ObjectPath (vname), typeName, new EvaluationResult (value), flags); } val.Name = name; */ return val; }
public DDebugBacktrace(DDebugSession session, long threadId, DEW.DBGEngine engine) : base(session, threadId, engine) { symbolResolver = new MonoDSymbolResolver(this, engine); }