Esempio n. 1
0
        public void PushAgentDispatcherFrame(DispatcherFrame frame, jvmtiEnvHandle environment)
        {
            Contract.Requires <ArgumentNullException>(frame != null, "frame");
            Contract.Requires <ArgumentNullException>(environment != null, "environment");

            lock (_dispatchers)
            {
                _dispatchers.Add(Tuple.Create(Dispatcher.CurrentDispatcher, frame, environment, default(IAsyncResult)));
            }

            Dispatcher.PushFrame(frame);
        }
Esempio n. 2
0
        private JvmtiEnvironment(JavaVM virtualMachine, jvmtiEnvHandle handle)
        {
            Contract.Requires <ArgumentNullException>(virtualMachine != null, "virtualMachine");

            _virtualMachine = virtualMachine;
            _handle         = handle;
            _rawInterface   = (jvmtiInterface)Marshal.PtrToStructure(Marshal.ReadIntPtr(handle.Handle), typeof(jvmtiInterface));

            jvmtiCapabilities previousCapabilities;

            JvmtiErrorHandler.ThrowOnFailure(RawInterface.GetCapabilities(this, out previousCapabilities));

            jvmtiCapabilities potentialCapabilities;

            JvmtiErrorHandler.ThrowOnFailure(RawInterface.GetPotentialCapabilities(this, out potentialCapabilities));

            var capabilities =
                new jvmtiCapabilities(
                    jvmtiCapabilities.CapabilityFlags1.CanTagObjects
                    | jvmtiCapabilities.CapabilityFlags1.CanGetSourceFileName
                    | jvmtiCapabilities.CapabilityFlags1.CanGetLineNumbers
                    | jvmtiCapabilities.CapabilityFlags1.CanGetSourceDebugExtension
                    | jvmtiCapabilities.CapabilityFlags1.CanAccessLocalVariables
                    | jvmtiCapabilities.CapabilityFlags1.CanGenerateSingleStepEvents
                    | jvmtiCapabilities.CapabilityFlags1.CanGenerateExceptionEvents
                    | jvmtiCapabilities.CapabilityFlags1.CanGenerateBreakpointEvents
                    | jvmtiCapabilities.CapabilityFlags1.CanGenerateFramePopEvents
                    | jvmtiCapabilities.CapabilityFlags1.CanGenerateAllClassHookEvents
                    | jvmtiCapabilities.CapabilityFlags1.CanGetBytecodes
                    | jvmtiCapabilities.CapabilityFlags1.CanSuspend,
                    jvmtiCapabilities.CapabilityFlags2.CanGetConstantPool
                    );

            JvmtiErrorHandler.ThrowOnFailure(RawInterface.AddCapabilities(this, ref capabilities));

            jvmtiCapabilities newCapabilities;

            JvmtiErrorHandler.ThrowOnFailure(RawInterface.GetCapabilities(this, out newCapabilities));
        }
Esempio n. 3
0
 private static JvmtiEnvironment CreateVirtualMachine(JavaVM virtualMachine, jvmtiEnvHandle handle)
 {
     return(new JvmtiEnvironment(virtualMachine, handle));
 }
Esempio n. 4
0
 internal static JvmtiEnvironment GetOrCreateInstance(JavaVM virtualMachine, jvmtiEnvHandle handle)
 {
     return(_instances.GetOrAdd(handle, i => CreateVirtualMachine(virtualMachine, i)));
 }