コード例 #1
0
 public ReferenceTypeData(TaggedReferenceTypeId type, string signature, string genericSignature, ClassStatus status)
 {
     ReferenceTypeTag = type.TypeTag;
     TypeId = type.TypeId;
     Signature = signature;
     GenericSignature = genericSignature;
     Status = status;
 }
コード例 #2
0
 public Error GetNestedTypes(out TaggedReferenceTypeId[] classes, ReferenceTypeId referenceType)
 {
     throw new NotImplementedException();
 }
コード例 #3
0
 public Error GetClassLoaderVisibleClasses(out TaggedReferenceTypeId[] classes, ClassLoaderId classLoaderObject)
 {
     throw new NotImplementedException();
 }
            public override bool ProcessEvent(JvmtiEnvironment environment, JniEnvironment nativeEnvironment, EventProcessor processor, ThreadId thread, TaggedReferenceTypeId @class, Location?location)
            {
                foreach (EventFilter filter in _filters)
                {
                    if (!filter.ProcessEvent(environment, nativeEnvironment, processor, thread, @class, location))
                    {
                        return(false);
                    }
                }

                return(true);
            }
コード例 #5
0
ファイル: ReferenceType.cs プロジェクト: Kav2018/JavaForVS
 protected ReferenceType(VirtualMachine virtualMachine, TaggedReferenceTypeId taggedTypeId)
     : base(virtualMachine)
 {
     Contract.Requires(virtualMachine != null);
     _taggedTypeId = taggedTypeId;
 }
コード例 #6
0
ファイル: VirtualMachine.cs プロジェクト: Kav2018/JavaForVS
        private ReferenceType CreateReferenceTypeMirror(TaggedReferenceTypeId type)
        {
            if (type == default(TaggedReferenceTypeId))
                return null;

            switch (type.TypeTag)
            {
            case TypeTag.Class:
                return new ClassType(this, (ClassId)type.TypeId);

            case TypeTag.Interface:
                return new InterfaceType(this, (InterfaceId)type.TypeId);

            case TypeTag.Array:
                return new ArrayType(this, (ArrayTypeId)type.TypeId);

            case TypeTag.Invalid:
            default:
                throw new DebuggerArgumentException("Invalid type tag.");
            }
        }
コード例 #7
0
ファイル: VirtualMachine.cs プロジェクト: Kav2018/JavaForVS
        internal ReferenceType GetMirrorOf(TaggedReferenceTypeId type)
        {
            if (type == default(TaggedReferenceTypeId))
                return null;

            return _referenceTypes.GetOrAdd(type, CreateReferenceTypeMirror);
        }
コード例 #8
0
ファイル: JvmtiEnvironment.cs プロジェクト: Kav2018/JavaForVS
        public jvmtiError GetImplementedInterfaces(JniEnvironment nativeEnvironment, jclass classHandle, out TaggedReferenceTypeId[] interfaces)
        {
            interfaces = null;

            int interfacesCount;
            IntPtr interfacesPtr;
            jvmtiError  error = RawInterface.GetImplementedInterfaces(this, classHandle, out interfacesCount, out interfacesPtr);
            if (error != jvmtiError.None)
                return error;

            try
            {
                List<TaggedReferenceTypeId> interfaceList = new List<TaggedReferenceTypeId>();
                unsafe
                {
                    jclass* interfaceHandles = (jclass*)interfacesPtr;
                    for (int i = 0; i < interfacesCount; i++)
                    {
                        if (interfaceHandles[i] == jclass.Null)
                            continue;

                        interfaceList.Add(VirtualMachine.TrackLocalClassReference(interfaceHandles[i], this, nativeEnvironment, true));
                    }
                }

                interfaces = interfaceList.ToArray();
                return jvmtiError.None;
            }
            finally
            {
                Deallocate(interfacesPtr);
            }
        }
コード例 #9
0
            public override bool ProcessEvent(JvmtiEnvironment environment, JniEnvironment nativeEnvironment, EventProcessor processor, ThreadId thread, TaggedReferenceTypeId @class, Location? location)
            {
                if (!base.ProcessEvent(environment, nativeEnvironment, processor, thread, @class, location))
                    return false;

                // Step Out is implemented with Frame Pop events set at the correct depth
                if (_depth == StepDepth.Out)
                {
                    if (location.HasValue && !location.Value.Method.Equals(_lastMethod))
                    {
                        _lastLocation = new jlocation((long)location.Value.Index);
                        _lastMethod = location.Value.Method;
                        UpdateLastLine(environment);
                    }

                    return true;
                }

                using (var threadHandle = environment.VirtualMachine.GetLocalReferenceForThread(nativeEnvironment, thread))
                {
                    int stackDepth;
                    JvmtiErrorHandler.ThrowOnFailure(environment.GetFrameCount(threadHandle.Value, out stackDepth));

                    if (_hasMethodInfo && stackDepth > _stackDepth)
                    {
                        bool convertToFramePop;
                        if (location.HasValue && (!_convertedToFramePop || !_framePopMethod.Equals(location.Value.Method)) && ShouldSkipCurrentMethod(processor.VirtualMachine, environment, nativeEnvironment, threadHandle.Value, stackDepth, location.Value, out convertToFramePop))
                        {
                            if (convertToFramePop)
                            {
                                // remove the single step event
                                JvmtiErrorHandler.ThrowOnFailure((jvmtiError)processor.ClearEventInternal(EventKind.FramePop, this.RequestId));
                                JvmtiErrorHandler.ThrowOnFailure((jvmtiError)processor.ClearEventInternal(EventKind.SingleStep, this.RequestId));
                                // set an actual step filter to respond when the thread arrives back in this frame
                                JvmtiErrorHandler.ThrowOnFailure((jvmtiError)processor.SetEventInternal(environment, nativeEnvironment, EventKind.FramePop, this));
                                _convertedToFramePop = true;
                                _framePopMethod = location.Value.Method;
                            }

                            return false;
                        }
                        else
                        {
                            _convertedToFramePop = false;
                            return true;
                        }
                    }
                    else if (stackDepth == _stackDepth)
                    {
                        if (_size == StepSize.Statement && _disassembledMethod != null)
                        {
                            int instructionIndex = _disassembledMethod.Instructions.FindIndex(i => (uint)i.Offset == location.Value.Index);
                            if (instructionIndex >= 0 && _evaluationStackDepths != null && (_evaluationStackDepths[instructionIndex] ?? 0) != 0)
                            {
                                return false;
                            }
                            else if (instructionIndex >= 0 && _disassembledMethod.Instructions[instructionIndex].OpCode.FlowControl == JavaFlowControl.Branch)
                            {
                                // follow branch instructions before stopping
                                return false;
                            }
                        }
                        else if (_lastLine != null)
                        {
                            // see if we're on the same line
                            LineNumberData[] lines;
                            jvmtiError error = environment.GetLineNumberTable(location.Value.Method, out lines);
                            if (error == jvmtiError.None)
                            {
                                LineNumberData entry = lines.LastOrDefault(i => i.LineCodeIndex <= (long)location.Value.Index);
                                if (entry.LineNumber == _lastLine)
                                    return false;
                            }
                        }
                    }

                    if (location.HasValue)
                    {
                        _lastLocation = new jlocation((long)location.Value.Index);
                        _lastMethod = location.Value.Method;
                        UpdateLastLine(environment);
                    }

                    _stackDepth = stackDepth;
                    return true;
                }
            }
コード例 #10
0
 public override bool ProcessEvent(JvmtiEnvironment environment, JniEnvironment nativeEnvironment, EventProcessor processor, ThreadId thread, TaggedReferenceTypeId @class, Location? location)
 {
     return true;
 }
コード例 #11
0
            public override bool ProcessEvent(JvmtiEnvironment environment, JniEnvironment nativeEnvironment, EventProcessor processor, ThreadId thread, TaggedReferenceTypeId @class, Location? location)
            {
                if (!location.HasValue)
                    return false;

                return _location.Index == location.Value.Index
                    && _location.Class == location.Value.Class
                    && _location.Method == location.Value.Method;
            }
コード例 #12
0
            public override bool ProcessEvent(JvmtiEnvironment environment, JniEnvironment nativeEnvironment, EventProcessor processor, ThreadId thread, TaggedReferenceTypeId @class, Location? location)
            {
                _current++;
                if (_current == _count)
                {
                    _current = 0;
                    return true;
                }

                return false;
            }
コード例 #13
0
            public override bool ProcessEvent(JvmtiEnvironment environment, JniEnvironment nativeEnvironment, EventProcessor processor, ThreadId thread, TaggedReferenceTypeId @class, Location? location)
            {
                foreach (EventFilter filter in _filters)
                {
                    if (!filter.ProcessEvent(environment, nativeEnvironment, processor, thread, @class, location))
                        return false;
                }

                return true;
            }
コード例 #14
0
ファイル: JvmtiEnvironment.cs プロジェクト: Kav2018/JavaForVS
        public jvmtiError GetMethodDeclaringClass(JniEnvironment nativeEnvironment, MethodId methodId, out TaggedReferenceTypeId declaringClass)
        {
            declaringClass = default(TaggedReferenceTypeId);

            jclass classHandle;
            jvmtiError error = RawInterface.GetMethodDeclaringClass(this, (jmethodID)methodId, out classHandle);
            if (error != jvmtiError.None)
                return error;

            declaringClass = VirtualMachine.TrackLocalClassReference(classHandle, this, nativeEnvironment, true);
            return jvmtiError.None;
        }
コード例 #15
0
ファイル: Location.cs プロジェクト: fjnogueira/JavaForVS
 public Location(TaggedReferenceTypeId declaringClass, MethodId method, ulong index)
     : this(declaringClass.TypeTag, (ClassId)declaringClass.TypeId, method, index)
 {
 }
コード例 #16
0
 public abstract bool ProcessEvent(JvmtiEnvironment environment, JniEnvironment nativeEnvironment, EventProcessor processor, ThreadId thread, TaggedReferenceTypeId @class, Location? location);
コード例 #17
0
            private void SendClassPrepareEvent(JvmtiEnvironment environment, EventFilter filter, ThreadId threadId, TaggedReferenceTypeId classId, string signature, ClassStatus classStatus, bool preventSuspend)
            {
                if (!VirtualMachine.IsAgentThread.Value)
                {
                    // ignore events before VMInit
                    if (AgentEventDispatcher == null)
                        return;

                    // dispatch this call to an agent thread
                    Action<JvmtiEnvironment, EventFilter, ThreadId, TaggedReferenceTypeId, string, ClassStatus, bool> method = SendClassPrepareEvent;
                    AgentEventDispatcher.Invoke(method, environment, filter, threadId, classId, signature, classStatus, preventSuspend);
                    return;
                }

                JniEnvironment nativeEnvironment;
                JniErrorHandler.ThrowOnFailure(VirtualMachine.AttachCurrentThreadAsDaemon(environment, out nativeEnvironment, true));

                SuspendPolicy suspendPolicy = preventSuspend ? SuspendPolicy.None : filter.SuspendPolicy;
                if (!preventSuspend)
                    ApplySuspendPolicy(environment, nativeEnvironment, filter.SuspendPolicy, threadId);

                Callback.ClassPrepare(suspendPolicy, filter.RequestId, threadId, classId.TypeTag, classId.TypeId, signature, classStatus);
            }
コード例 #18
0
ファイル: JvmtiEnvironment.cs プロジェクト: Kav2018/JavaForVS
        public jvmtiError GetLoadedClasses(JniEnvironment nativeEnvironment, out TaggedReferenceTypeId[] classes)
        {
            classes = null;

            int classCount;
            IntPtr classesPtr;
            jvmtiError error = RawInterface.GetLoadedClasses(this, out classCount, out classesPtr);
            if (error != jvmtiError.None)
                return error;

            try
            {
                List<TaggedReferenceTypeId> classList = new List<TaggedReferenceTypeId>();
                unsafe
                {
                    jclass* classHandles = (jclass*)classesPtr;
                    for (int i = 0; i < classCount; i++)
                    {
                        if (classHandles[i] == jclass.Null)
                            continue;

                        classList.Add(VirtualMachine.TrackLocalClassReference(classHandles[i], this, nativeEnvironment, true));
                    }
                }

                classes = classList.ToArray();
                return jvmtiError.None;
            }
            finally
            {
                Deallocate(classesPtr);
            }
        }