internal IEnumerable <TraceVar> ObtainTraceVars(WorkerThread thread, Ela.Runtime.CallStack stack) { var sym = thread.Module.Symbols; var mem = stack.Peek(); var locals = mem.Locals; var captures = mem.Captures; var off = thread.Offset; var dr = new DebugReader(sym); var scope = dr.FindScopeSym(off); var vars = dr.FindVarSyms(off, scope).ToList(); var alls = new FastList <ElaValue[]>(); alls.AddRange(captures); alls.Add(locals); var count = alls.Count - 1; var locs = alls[count]; var ret = new List <TraceVar>(); do { for (var i = 0; i < vars.Count; i++) { var v = vars[i]; var val = locs[v.Address]; if (((ElaVariableFlags)v.Flags & ElaVariableFlags.CompilerGenerated) != ElaVariableFlags.CompilerGenerated) { ret.Add(new TraceVar(v.Name, val, locs == locals)); } } var ns = dr.GetScopeSymByIndex(scope.ParentIndex); if (ns.Index != scope.Index) { scope = ns; vars = dr.FindVarSyms(off, scope).ToList(); if (scope.RuntimeScope && count > 0) { locs = alls[--count]; } } else { scope = null; } }while (scope != null); return(ret); }