Holds the location in the source code corresponding to an actual machine address. Note that the difference between an "address" and a "location" is that a location is basically just a name for a specific source code location while an address contains some additional information which are only valid while the corresponding method is actually loaded in memory. This means that you can easily transform a SourceAddress in a SourceLocation, but not the other way around. If you insert a breakpoint on a location, the debugger will automatically compute the actual address once the corresponding method has been loaded.
Inheritance: DebuggerMarshalByRefObject
示例#1
0
 void compute_source()
 {
     lock (this) {
         if (has_source)
         {
             return;
         }
         has_source = true;
         if ((method == null) || !method.HasSource || !method.HasLineNumbers)
         {
             return;
         }
         source = method.LineNumberTable.Lookup(address);
         if (source == null)
         {
             return;
         }
         if (method.MethodSource.IsDynamic)
         {
             return;
         }
         location = new SourceLocation(
             method.MethodSource, source.SourceFile, source.Row);
     }
 }
示例#2
0
 internal StackFrame(Thread thread, FrameType type, TargetAddress address,
                     TargetAddress stack_ptr, TargetAddress frame_address,
                     Registers registers, Method method, SourceAddress source)
     : this(thread, type, address, stack_ptr, frame_address, registers, method)
 {
     this.source = source;
     if (method.HasSource && !method.MethodSource.IsDynamic)
     {
         location = new SourceLocation(
             method.MethodSource, source.SourceFile, source.Row);
     }
     has_source = true;
 }
示例#3
0
        protected override bool DoResolve(ScriptingContext context)
        {
            int line = -1;
            int pos = Argument.IndexOf (':');
            if (pos >= 0) {
                string filename = Argument.Substring (0, pos);
                try {
                    line = (int) UInt32.Parse (Argument.Substring (pos+1));
                } catch {
                    throw new ScriptingException ("Expected filename:line");
                }

                return FindFile (context, filename, line);
            }

            if (Argument == "") {
                StackFrame frame = context.CurrentFrame;

                if (frame.SourceAddress == null)
                    return false;

                if (frame.SourceLocation != null)
                    location = frame.SourceLocation;
                else
                    address = frame.SourceAddress;

                return true;
            }

            try {
                line = (int) UInt32.Parse (Argument);
            } catch {
            }

            if (line != -1) {
                location = context.CurrentLocation;
                if (location.FileName == null)
                    throw new ScriptingException (
                        "Location doesn't have any source code.");

                return FindFile (context, location.FileName, line);
            }

            MethodExpression mexpr;
            try {
                Expression expr = ParseExpression (context);
                if (expr == null)
                    return false;

                mexpr = expr.ResolveMethod (context, type);
            } catch {
                mexpr = null;
            }

            if (mexpr != null) {
                TargetFunctionType func;
                try {
                    func = mexpr.EvaluateMethod (context, type, null);
                } catch {
                    func = null;
                }

                if (func != null)
                    method = func.GetSourceCode ();

                location = mexpr.EvaluateSource (context);
            } else
                location = context.FindMethod (Argument);

            if (location == null)
                throw new ScriptingException (
                    "Location doesn't have any source code.");

            return true;
        }
示例#4
0
 void compute_source()
 {
     lock (this) {
         if (has_source)
             return;
         has_source = true;
         if ((method == null) || !method.HasSource || !method.HasLineNumbers)
             return;
         source = method.LineNumberTable.Lookup (address);
         if (source == null)
             return;
         if (method.MethodSource.IsDynamic)
             return;
         location = new SourceLocation (
             method.MethodSource, source.SourceFile, source.Row);
     }
 }
示例#5
0
        internal StackFrame(Thread thread, FrameType type, TargetAddress address,
				     TargetAddress stack_ptr, TargetAddress frame_address,
				     Registers registers, Method method, SourceAddress source)
            : this(thread, type, address, stack_ptr, frame_address, registers, method)
        {
            this.source = source;
            if (method.HasSource && !method.MethodSource.IsDynamic)
                location = new SourceLocation (
                    method.MethodSource, source.SourceFile, source.Row);
            has_source = true;
        }