public BacktraceHandle(ProcessHandle process, Backtrace backtrace)
 {
     StackFrame[] bt_frames = backtrace.Frames;
     if (bt_frames != null) {
         frames = new FrameHandle [bt_frames.Length];
         for (int i = 0; i < frames.Length; i++)
             frames [i] = new FrameHandle (bt_frames [i]);
     } else
         frames = new FrameHandle [0];
 }
        public FrameHandle GetFrame(int number)
        {
            if (State == TargetState.NO_TARGET)
                throw new EvaluationException ("No stack.");
            else if (!process.IsStopped)
                throw new EvaluationException ("{0} is not stopped.", Name);

            if (number == -1) {
                if (current_frame == null)
                    current_frame = new FrameHandle (process.CurrentFrame);

                return current_frame;
            }

            GetBacktrace (-1);
            if (number >= current_backtrace.Length)
                throw new EvaluationException ("No such frame: {0}", number);

            return current_backtrace [number];
        }
 public ProcessHandle(Process process, int pid)
     : this(process)
 {
     if (process.HasTarget) {
         if (!process.IsDaemon) {
             StackFrame frame = process.CurrentFrame;
             current_frame = new FrameHandle (frame);
         }
     }
 }
        public string[] GetNamespaces(FrameHandle frame)
        {
            IMethod method = frame.Frame.Method;
            if ((method == null) || !method.HasSource)
                return null;

            MethodSource msource = method.Source;
            if (msource.IsDynamic)
                return null;

            return msource.GetNamespaces ();
        }
        protected override Expression DoResolve(EvaluationContext context)
        {
            frame = context.CurrentFrame;
            IMethod method = frame.Frame.Method;
            if (method == null)
                throw new EvaluationException (
                    "Keyword `this' not allowed: no current method.");

            if (!method.HasThis)
                throw new EvaluationException (
                    "Keyword `this' not allowed: current method is " +
                    "either static or unmanaged.");

            var = method.This;
            resolved = true;
            return this;
        }
        Expression LookupMember(EvaluationContext context, FrameHandle frame,
					 string full_name)
        {
            return StructAccessExpression.FindMember (
                context.This.TypeInfo.Type as ITargetStructType, frame.Frame,
                (ITargetStructObject) context.This, false, full_name);
        }
        Expression Lookup(EvaluationContext context, FrameHandle frame)
        {
            string[] namespaces = context.GetNamespaces (frame);
            if (namespaces == null)
                return null;

            foreach (string ns in namespaces) {
                string full_name = MakeFQN (ns, name);
                Expression expr = LookupMember (context, frame, full_name);
                if (expr != null)
                    return expr;
            }

            return null;
        }