~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to src/addins/MonoDevelop.Debugger.Soft/Mono.Debugging.Soft/SoftEvaluationContext.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
                {
45
45
                        Frame = frame;
46
46
                        Thread = frame.Thread;
47
 
                
48
 
                
 
47
 
49
48
                        string method = frame.Method.Name;
50
49
                        if (frame.Method.DeclaringType != null)
51
50
                                method = frame.Method.DeclaringType.FullName + "." + method;
52
 
                        var location = new DC.SourceLocation (method, frame.FileName, frame.LineNumber);
53
 
                        var lang = frame.Method != null? "Managed" : "Native";
 
51
                        var location = new DC.SourceLocation (method, frame.FileName, frame.LineNumber, frame.ColumnNumber);
 
52
                        string language;
 
53
 
 
54
                        if (frame.Method != null) {
 
55
                                if (frame.IsNativeTransition) {
 
56
                                        language = "Transition";
 
57
                                } else {
 
58
                                        language = "Managed";
 
59
                                }
 
60
                        } else {
 
61
                                language = "Native";
 
62
                        }
54
63
                        
55
 
                        Evaluator = session.GetEvaluator (new DC.StackFrame (frame.ILOffset, location, lang, session.IsExternalCode (frame), true));
 
64
                        Evaluator = session.GetEvaluator (new DC.StackFrame (frame.ILOffset, location, language, session.IsExternalCode (frame), true));
56
65
                        Adapter = session.Adaptor;
57
66
                        this.session = session;
58
67
                        this.stackVersion = session.StackVersion;
101
110
                        Thread = other.Thread;
102
111
                        session = other.session;
103
112
                }
 
113
 
 
114
                static bool IsValueTypeOrPrimitive (TypeMirror type)
 
115
                {
 
116
                        return type != null && (type.IsValueType || type.IsPrimitive);
 
117
                }
 
118
 
 
119
                static bool IsValueTypeOrPrimitive (Type type)
 
120
                {
 
121
                        return type != null && (type.IsValueType || type.IsPrimitive);
 
122
                }
104
123
                
105
124
                public Value RuntimeInvoke (MethodMirror method, object target, Value[] values)
106
125
                {
110
129
                                if (mparams.Length != values.Length)
111
130
                                        throw new EvaluatorException ("Invalid number of arguments when calling: " + method.Name);
112
131
                                
113
 
                                for (int n=0; n<mparams.Length; n++) {
 
132
                                for (int n = 0; n < mparams.Length; n++) {
114
133
                                        TypeMirror tm = mparams [n].ParameterType;
115
134
                                        if (tm.IsValueType || tm.IsPrimitive)
116
135
                                                continue;
 
136
 
117
137
                                        object type = Adapter.GetValueType (this, values [n]);
118
138
                                        TypeMirror argTypeMirror = type as TypeMirror;
119
139
                                        Type argType = type as Type;
120
 
                                        if ((argTypeMirror != null && (argTypeMirror.IsValueType || argTypeMirror.IsPrimitive)) || (argType != null && (argType.IsValueType || argType.IsPrimitive))) {
 
140
 
 
141
                                        if (IsValueTypeOrPrimitive (argTypeMirror) || IsValueTypeOrPrimitive (argType)) {
121
142
                                                // A value type being assigned to a parameter which is not a value type. The value has to be boxed.
122
143
                                                try {
123
144
                                                        values [n] = Thread.Domain.CreateBoxedValue (values [n]);
129
150
                                }
130
151
                        }
131
152
 
132
 
                        if (!method.IsStatic && method.DeclaringType.IsClass) {
 
153
                        if (!method.IsStatic && method.DeclaringType.IsClass && !IsValueTypeOrPrimitive (method.DeclaringType)) {
133
154
                                object type = Adapter.GetValueType (this, target);
134
155
                                TypeMirror targetTypeMirror = type as TypeMirror;
135
156
                                Type targetType = type as Type;
136
157
 
137
 
                                if ((targetTypeMirror != null && (targetTypeMirror.IsValueType || targetTypeMirror.IsPrimitive)) || (targetType != null && (targetType.IsValueType || targetType.IsPrimitive))) {
 
158
                                if ((target is StructMirror && ((StructMirror) target).Type != method.DeclaringType) ||
 
159
                                    (IsValueTypeOrPrimitive (targetTypeMirror) || IsValueTypeOrPrimitive (targetType))) {
138
160
                                        // A value type being assigned to a parameter which is not a value type. The value has to be boxed.
139
161
                                        try {
140
162
                                                target = Thread.Domain.CreateBoxedValue ((Value) target);