public static MITextPosition TryParse(TupleValue miTuple) { string filename = miTuple.TryFindString("fullname"); if (string.IsNullOrEmpty(filename)) { filename = miTuple.TryFindString("file"); } if (!string.IsNullOrEmpty(filename)) { filename = DebuggedProcess.UnixPathToWindowsPath(filename); } if (string.IsNullOrWhiteSpace(filename)) { return(null); } uint?line = miTuple.TryFindUint("line"); if (!line.HasValue || line.Value == 0) { return(null); } uint lineValue = line.Value; var startPosition = new TEXT_POSITION() { dwLine = lineValue - 1, dwColumn = 0 }; uint?startColumn = miTuple.TryFindUint("col"); if (startColumn > 0) { startPosition.dwColumn = startColumn.Value - 1; } TEXT_POSITION endPosition = startPosition; uint? endLine = miTuple.TryFindUint("end-line"); if (endLine > 0) { endPosition.dwLine = endLine.Value - 1; uint?endCol = miTuple.TryFindUint("end-col"); if (endCol > 0) { endPosition.dwColumn = endCol.Value - 1; } } return(new MITextPosition(filename, startPosition, endPosition)); }
public static MITextPosition TryParse(DebuggedProcess process, TupleValue miTuple) { string filename = process.GetMappedFileFromTuple(miTuple); if (!string.IsNullOrEmpty(filename)) { filename = DebuggedProcess.UnixPathToWindowsPath(filename); } if (string.IsNullOrWhiteSpace(filename)) { return(null); } uint?line = miTuple.TryFindUint("line"); if (!line.HasValue || line.Value == 0) { return(null); } uint lineValue = line.Value; Microsoft.VisualStudio.Debugger.Interop.TEXT_POSITION startPosition = new Microsoft.VisualStudio.Debugger.Interop.TEXT_POSITION(); startPosition.dwLine = lineValue - 1; startPosition.dwColumn = 0; uint?startColumn = miTuple.TryFindUint("col"); if (startColumn > 0) { startPosition.dwColumn = startColumn.Value - 1; } Microsoft.VisualStudio.Debugger.Interop.TEXT_POSITION endPosition = startPosition; uint?endLine = miTuple.TryFindUint("end-line"); if (endLine > 0) { endPosition.dwLine = endLine.Value - 1; uint?endCol = miTuple.TryFindUint("end-col"); if (endCol > 0) { endPosition.dwColumn = endCol.Value - 1; } } return(new MITextPosition(filename, startPosition, endPosition)); }
public static MITextPosition TryParse(TupleValue miTuple) { string filename = miTuple.TryFindString("fullname"); if (string.IsNullOrEmpty(filename)) { filename = miTuple.TryFindString("file"); } if (!string.IsNullOrEmpty(filename)) { filename = DebuggedProcess.UnixPathToWindowsPath(filename); } if (string.IsNullOrWhiteSpace(filename)) return null; uint? line = miTuple.TryFindUint("line"); if (!line.HasValue || line.Value == 0) return null; uint lineValue = line.Value; Microsoft.VisualStudio.Debugger.Interop.TEXT_POSITION startPosition = new Microsoft.VisualStudio.Debugger.Interop.TEXT_POSITION(); startPosition.dwLine = lineValue - 1; startPosition.dwColumn = 0; uint? startColumn = miTuple.TryFindUint("col"); if (startColumn > 0) { startPosition.dwColumn = startColumn.Value - 1; } Microsoft.VisualStudio.Debugger.Interop.TEXT_POSITION endPosition = startPosition; uint? endLine = miTuple.TryFindUint("end-line"); if (endLine > 0) { endPosition.dwLine = endLine.Value - 1; uint? endCol = miTuple.TryFindUint("end-col"); if (endCol > 0) { endPosition.dwColumn = endCol.Value - 1; } } return new MITextPosition(filename, startPosition, endPosition); }
//this constructor is private because it should only be used internally to create children private VariableInformation(TupleValue results, VariableInformation parent, string name = null) : this(parent._ctx, parent._engine, parent.Client) { TypeName = results.TryFindString("type"); Value = results.TryFindString("value"); Name = name ?? results.FindString("exp"); if (results.Contains("dynamic")) { CountChildren = results.TryFindUint("has_more").GetValueOrDefault(1); IsPreformatted = true; } else { CountChildren = results.FindUint("numchild"); } if (results.Contains("displayhint")) { DisplayHint = results.FindString("displayhint"); } if (results.Contains("attributes")) { if (results.FindString("attributes") == "noneditable") { _isReadonly = true; } _attribsFetched = true; } int index; if (!results.Contains("value") && (Name == TypeName || Name.Contains("::"))) { // base classes show up with no value and exp==type // (sometimes underlying debugger does not follow this convention, when using typedefs in templated types so look for "::" in the field name too) Name = TypeName + " (base)"; Value = TypeName; VariableNodeType = NodeType.BaseClass; } else if (Int32.TryParse(this.Name, System.Globalization.NumberStyles.Integer, null, out index)) // array element { Name = '[' + this.Name + ']'; VariableNodeType = NodeType.ArrayElement; } else if (this.Name.Length > 2 && this.Name[0] == '[' && this.Name[this.Name.Length - 1] == ']') { VariableNodeType = NodeType.ArrayElement; } else if (Name == "<anonymous union>") { VariableNodeType = NodeType.AnonymousUnion; } else { _strippedName = Name; VariableNodeType = NodeType.Field; } _internalName = results.FindString("name"); IsChild = true; _format = parent._format; // inherit formatting _parent = parent.VariableNodeType == NodeType.AccessQualifier ? parent._parent : parent; this.PropertyInfoFlags = parent.PropertyInfoFlags; }