public int GetEnvironment(out JvmtiEnvironment environment) { jvmtiEnvHandle env; int error = RawInterface.GetEnv(this, out env, jvmtiVersion.Version1_1); if (error == 0) { environment = JvmtiEnvironment.GetOrCreateInstance(this, env); } else { environment = null; } return(error); }
public int AttachCurrentThreadAsDaemon(JvmtiEnvironment environment, out JniEnvironment nativeEnvironment, bool agentThread) { JavaVMAttachArgs args = new JavaVMAttachArgs(jniVersion.Version1_6, IntPtr.Zero, jthreadGroup.Null); bool alreadyAgent = IsAgentThread.Value; if (agentThread && !alreadyAgent) { IsAgentThread.Value = true; } JNIEnvHandle jniEnv; int error = RawInterface.AttachCurrentThreadAsDaemon(this, out jniEnv, ref args); if (error == 0) { bool created; nativeEnvironment = JniEnvironment.GetOrCreateInstance(jniEnv, out created); if (agentThread && !alreadyAgent) { if (environment == null) { GetEnvironment(out environment); } jthread thread; JvmtiErrorHandler.ThrowOnFailure(environment.RawInterface.GetCurrentThread(environment, out thread)); if (thread != jthread.Null) { ThreadId threadId = TrackLocalThreadReference(thread, environment, nativeEnvironment, true); lock (_agentThreads) { _agentThreads.Add(threadId); } } } } else { nativeEnvironment = null; } return(error); }
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)); }
public SBus(uint index) { this.rif = new FT245(index); this.rif.open(); }