Inheritance: IEnumerable
コード例 #1
0
 public NodeBacktrace(NodeDebuggerSession session, long threadId, int count, ResultData firstFrame)
 {
     fcount = count;
     this.threadId = threadId;
     if (firstFrame != null)
         this.firstFrame = CreateFrame (firstFrame);
     this.session = session;
 }
コード例 #2
0
        object ReadValue(string str, ref int pos)
        {
            if (str [pos] == '"') {
                pos++;
                string ret = ReadString (str, '"', ref pos);
                pos++;
                return ret;
            }
            if (str [pos] == '{') {
                pos++;
                ResultData data = new ResultData ();
                ReadTuple (str, ref pos, data);
                return data;
            }
            if (str [pos] == '[') {
                pos++;
                return ReadArray (str, ref pos);
            }

            // Single value tuple
            string name;
            object val;
            ReadResult (str, ref pos, out name, out val);
            ResultData sdata = new ResultData ();
            sdata.props = new Hashtable ();
            sdata.props [name] = val;
            return sdata;
        }
コード例 #3
0
        void ReadTuple(string str, ref int pos, ResultData data)
        {
            if (data.props == null)
                data.props = new Hashtable ();

            while (pos < str.Length && str [pos] != '}') {
                string name;
                object val;
                ReadResult (str, ref pos, out name, out val);
                if (data.props.ContainsKey (name)) {
                    object ob = data.props [name];
                    ResultData rd = ob as ResultData;
                    if (rd != null && rd.isArrayProperty) {
                        object[] newArr = new object [rd.array.Length + 1];
                        Array.Copy (rd.array, newArr, rd.array.Length);
                        newArr [rd.array.Length] = val;
                        rd.array = newArr;
                    } else {
                        rd = new ResultData ();
                        rd.isArrayProperty = true;
                        rd.array = new object [2];
                        rd.array [0] = ob;
                        rd.array [1] = val;
                        data.props [name] = rd;
                    }
                } else {
                    data.props [name] = val;
                }
                TryReadChar (str, ref pos, ',');
            }
            TryReadChar (str, ref pos, '}');
        }
コード例 #4
0
 ResultData ReadArray(string str, ref int pos)
 {
     ArrayList list = new ArrayList ();
     while (pos < str.Length && str [pos] != ']') {
         object val = ReadValue (str, ref pos);
         list.Add (val);
         TryReadChar (str, ref pos, ',');
     }
     TryReadChar (str, ref pos, ']');
     ResultData arr = new ResultData ();
     arr.array = list.ToArray ();
     return arr;
 }
コード例 #5
0
        ObjectValue CreateObjectValue(string name, ResultData data)
        {
            string vname = data.GetValue ("name");
            string typeName = data.GetValue ("type");
            string value = data.GetValue ("value");
            int nchild = data.GetInt ("numchild");

            ObjectValue val;
            ObjectValueFlags flags = ObjectValueFlags.Variable;

            // There can be 'public' et al children for C++ structures
            if (typeName == null)
                typeName = "none";

            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;
        }
コード例 #6
0
        StackFrame CreateFrame(ResultData frameData)
        {
            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);
        }