Esempio n. 1
0
        public void Trace(string tracePoint, LineSym line, IEnumerable <TraceVar> vars)
        {
            var name = String.Format("Trace point: {0} (Line: {1}; Column: {2}; Offset: {3})", tracePoint,
                                     line.Line, line.Column, line.Offset);
            var sep = new String('*', name.Length);

            var local = false;

            Console.WriteLine(sep);
            Console.WriteLine(name);
            Console.WriteLine(sep);

            foreach (var c in vars)
            {
                if (c.Local && !local)
                {
                    Console.WriteLine("Locals:");
                    local = true;
                }
                else if (!c.Local && local)
                {
                    Console.WriteLine();
                    Console.WriteLine("Captured:");
                    local = false;
                }

                Console.WriteLine("{0} = {1}", c.Name, ObtainValue(c.Value));
            }

            Console.WriteLine(sep);
        }
Esempio n. 2
0
 internal CallFrame(string moduleName, string codeBlockName, int offset, LineSym lineSym)
 {
     CodeBlockName = codeBlockName;
     ModuleName    = moduleName;
     Offset        = offset;
     LinePragma    = lineSym;
 }
Esempio n. 3
0
        public void Trace(string tracePoint, LineSym line, IEnumerable <TraceVar> vars)
        {
            var grid = (DebugView)app.GetService <IViewService>().GetView("Debug");

            grid.AddItems(vars.Select(v => new TraceItem(tracePoint, line, v)));
        }
Esempio n. 4
0
 internal CallFrame(string?moduleName, string codeBlockName, int offset, LineSym lineSym) =>
 (CodeBlockName, ModuleName, Offset, LinePragma) = (moduleName, codeBlockName, offset, lineSym);
Esempio n. 5
0
        private static void ReadSymbols(BinaryReader reader, Unit unit)
        {
            var di = new DebugInfo();

            unit.Symbols = di;
            di.File      = reader.ReadString();

            var scopes = reader.ReadInt32();

            for (var i = 0; i < scopes; i++)
            {
                var s = new ScopeSym();
                s.Index       = reader.ReadInt32();
                s.ParentIndex = reader.ReadInt32();
                s.StartOffset = reader.ReadInt32();
                s.EndOffset   = reader.ReadInt32();
                s.StartLine   = reader.ReadInt32();
                s.StartColumn = reader.ReadInt32();
                s.EndLine     = reader.ReadInt32();
                s.EndColumn   = reader.ReadInt32();
                di.Scopes.Add(s);
            }

            var lines = reader.ReadInt32();

            for (var i = 0; i < lines; i++)
            {
                var l = new LineSym();
                l.Offset = reader.ReadInt32();
                l.Line   = reader.ReadInt32();
                l.Column = reader.ReadInt32();
                di.Lines.Add(l);
            }

            var vars = reader.ReadInt32();

            for (var i = 0; i < vars; i++)
            {
                var v = new VarSym();
                v.Name    = reader.ReadString();
                v.Address = reader.ReadInt32();
                v.Offset  = reader.ReadInt32();
                v.Scope   = reader.ReadInt32();
                v.Flags   = reader.ReadInt32();
                v.Data    = reader.ReadInt32();
                di.Vars.Add(v);
            }

            var funs = reader.ReadInt32();

            for (var i = 0; i < funs; i++)
            {
                var f = new FunSym();
                f.Name        = reader.ReadString();
                f.Handle      = reader.ReadInt32();
                f.StartOffset = reader.ReadInt32();
                f.EndOffset   = reader.ReadInt32();

                var pars = reader.ReadInt32();
                f.Parameters = new Par[pars];
                for (var j = 0; j < pars; j++)
                {
                    var name  = reader.ReadString();
                    var va    = reader.ReadBoolean();
                    var value = ObjectFile.DeserializeObject(reader);
                    var p     = new Par(name, value, va);
                    f.Parameters[j] = p;
                }

                di.Functions.Add(f.Handle, f);
            }
        }
Esempio n. 6
0
 public TraceItem(string name, LineSym lineInfo, TraceVar var)
 {
     TracePointName = name;
     LineInfo       = lineInfo;
     Var            = var;
 }
Esempio n. 7
0
        private CodeFrame Read(BinaryReader bw)
        {
            var frame = new CodeFrame();

            frame.GlobalScope = new Scope(false, null);
            var v = bw.ReadInt32();

            if (v != Version)
            {
                throw new ElaLinkerException(Strings.GetMessage("InvalidObjectFile", Version), null);
            }

            bw.ReadInt32(); //Version: Major
            bw.ReadInt32(); //Version: Minor
            bw.ReadInt32(); //Version: Build
            bw.ReadInt32(); //Version: Revision
            bw.ReadInt64(); //Version: Date stamp

            var c = bw.ReadInt32();

            for (var i = 0; i < c; i++)
            {
                var alias   = bw.ReadString();
                var modName = bw.ReadString();
                var dllName = bw.ReadString();
                dllName = dllName.Length == 0 ? null : dllName;
                var qual = bw.ReadBoolean();
                var pl   = bw.ReadInt32();
                var list = new string[pl];

                for (var j = 0; j < pl; j++)
                {
                    list[j] = bw.ReadString();
                }

                var lh = bw.ReadInt32();
                frame.AddReference(alias, new ModuleReference(frame, modName, dllName, list, 0, 0, qual, lh));
            }

            c = bw.ReadInt32();

            for (var i = 0; i < c; i++)
            {
                frame.GlobalScope.Locals.Add(bw.ReadString(),
                                             new ScopeVar((ElaVariableFlags)bw.ReadInt32(), bw.ReadInt32(), bw.ReadInt32()));
            }

            c = bw.ReadInt32();

            for (var i = 0; i < c; i++)
            {
                frame.LateBounds.Add(new LateBoundSymbol(
                                         bw.ReadString(), bw.ReadInt32(), bw.ReadInt32(), bw.ReadInt32(), bw.ReadInt32(),
                                         bw.ReadInt32()));
            }

            c = bw.ReadInt32();

            for (var i = 0; i < c; i++)
            {
                var l = new MemoryLayout(bw.ReadInt32(), bw.ReadInt32(), bw.ReadInt32());
                frame.Layouts.Add(l);
            }

            c = bw.ReadInt32();

            for (var i = 0; i < c; i++)
            {
                frame.Strings.Add(bw.ReadString());
            }

            c = bw.ReadInt32();

            for (var i = 0; i < c; i++)
            {
                var opCode = (Op)bw.ReadByte();
                frame.Ops.Add(opCode);
                frame.OpData.Add(OpSizeHelper.OpSize[(Int32)opCode] > 1 ? bw.ReadInt32() : 0);
            }

            c = bw.ReadInt32();

            for (var i = 0; i < c; i++)
            {
                frame.InternalTypes.Add(bw.ReadString(), bw.ReadInt32());
            }

            c = bw.ReadInt32();

            for (var i = 0; i < c; i++)
            {
                var k   = bw.ReadString();
                var cc  = bw.ReadInt32();
                var mbr = new ElaClassMember[cc];

                for (var j = 0; j < cc; j++)
                {
                    var m = new ElaClassMember();
                    m.Components = bw.ReadInt32();
                    m.Mask       = bw.ReadInt32();
                    m.Name       = bw.ReadString();
                    mbr[j]       = m;
                }

                frame.InternalClasses.Add(k, new ClassData(mbr));
            }

            c = bw.ReadInt32();

            for (var i = 0; i < c; i++)
            {
                frame.InternalInstances.Add(new InstanceData(
                                                bw.ReadString(),
                                                bw.ReadString(),
                                                bw.ReadInt32(),
                                                bw.ReadInt32(),
                                                bw.ReadInt32(),
                                                bw.ReadInt32()));
            }

            c = bw.ReadInt32();

            for (var i = 0; i < c; i++)
            {
                var ct = new ConstructorData
                {
                    Code         = -1,
                    Name         = bw.ReadString(),
                    TypeName     = bw.ReadString(),
                    TypeModuleId = bw.ReadInt32()
                };
                var cc = bw.ReadInt32();

                if (cc > 0)
                {
                    ct.Parameters = new List <String>();

                    for (var j = 0; j < cc; j++)
                    {
                        ct.Parameters.Add(bw.ReadString());
                    }
                }

                frame.InternalConstructors.Add(ct);
            }

            var di = bw.ReadBoolean();

            if (di)
            {
                var sym = new DebugInfo();

                c = bw.ReadInt32();

                for (var i = 0; i < c; i++)
                {
                    var ln = new LineSym(bw.ReadInt32(), bw.ReadInt32(), bw.ReadInt32());
                    sym.Lines.Add(ln);
                }

                c = bw.ReadInt32();

                for (var i = 0; i < c; i++)
                {
                    var fn = new FunSym(bw.ReadString(), bw.ReadInt32(), bw.ReadInt32());
                    fn.Handle    = bw.ReadInt32();
                    fn.EndOffset = bw.ReadInt32();
                    sym.Functions.Add(fn);
                }

                frame.Symbols = sym;
            }

            return(frame);
        }