diff options
author | Etienne M. Gagnon <etienne.gagnon@uqam.ca> | 2004-03-29 07:07:23 +0000 |
---|---|---|
committer | Etienne M. Gagnon <etienne.gagnon@uqam.ca> | 2004-03-29 07:07:23 +0000 |
commit | db19fb74ad16353300e70d02e9a71678352f8f13 (patch) | |
tree | 81eaa3862f0c3adab78cd89d59acdec176c1162c /native/vmi | |
parent | 09f0b054866aa87e199ba9f01d6c40b2fcbed79b (diff) | |
download | classpath-db19fb74ad16353300e70d02e9a71678352f8f13.tar.gz |
Reverted.
Diffstat (limited to 'native/vmi')
-rwxr-xr-x | native/vmi/vmi.c | 162 | ||||
-rwxr-xr-x | native/vmi/vmi.h | 21 |
2 files changed, 83 insertions, 100 deletions
diff --git a/native/vmi/vmi.c b/native/vmi/vmi.c index c304acf99..07eef82f9 100755 --- a/native/vmi/vmi.c +++ b/native/vmi/vmi.c @@ -43,117 +43,101 @@ exception statement from your version. */ #include <native-threads.h> JNIEXPORT vmiError JNICALL -VMI_GetFrameClass (JNIEnv *env, jframeID frame, jclass *clazz) -{ - - return VMI_ERROR_NONE; +VMI_GetFrameClass(JNIEnv *env, + jframeID frame, + jclass *clazz) { + + return VMI_ERROR_NONE; } JNIEXPORT vmiError JNICALL -VMI_GetFrameObject (JNIEnv *env, jframeID frame, jobject *obj) -{ - StackFrame *sframe = (StackFrame *) frame; - if (env == NULL || obj == NULL) +VMI_GetFrameObject(JNIEnv *env, + jframeID frame, + jobject *obj) { + StackFrame *sframe = (StackFrame*)frame; + if(env == NULL || obj == NULL) return VMI_ERROR_NULL_POINTER; - if (frame == NULL) + if(frame == NULL) return VMI_ERROR_INVALID_FRAMEID; - *obj = THISPTR (sframe); + *obj = THISPTR(sframe); return VMI_ERROR_NONE; } JNIEXPORT vmiError JNICALL -VMI_GetThisFrame (JNIEnv *env, jframeID *frame) -{ +VMI_GetThisFrame(JNIEnv *env, jframeID *frame) { JThreadInfo *thread_info; - if (env == NULL || frame == NULL) + if(env == NULL || frame == NULL) return VMI_ERROR_NULL_POINTER; - thread_info = THREAD_getJavaInfo (); - *frame = (jframeID) TOPFRAME (thread_info); + thread_info = THREAD_getJavaInfo(); + *frame = (jframeID)TOPFRAME(thread_info); return VMI_ERROR_NONE; } JNIEXPORT vmiError JNICALL -VMI_GetThisThreadObject (JNIEnv *env, jthread *thread) -{ +VMI_GetThisThreadObject(JNIEnv* env, jthread *thread) { JThreadInfo *thread_info; - if (env == NULL || thread == NULL) + if(env == NULL || thread == NULL) return VMI_ERROR_NULL_POINTER; - thread_info = THREAD_getJavaInfo (); - *thread = (jthread) thread_info->java_thread; + thread_info = THREAD_getJavaInfo(); + *thread = (jthread)thread_info->java_thread; return VMI_ERROR_NONE; } JNIEXPORT void JNICALL -VMI_ThrowAppropriateException (JNIEnv *env, vmiError err) -{ - switch (err) - { - case VMI_ERROR_NONE: - JCL_ThrowException (env, "java/lang/InternalError", - "ERROR_NONE passed to VMI exception thrower."); - break; - case VMI_ERROR_NULL_POINTER: - JCL_ThrowException (env, "java/lang/NullPointerException", - "null pointer in VMI detected."); - break; - case VMI_ERROR_OUT_OF_MEMORY: - JCL_ThrowException (env, "java/lang/OutOfMemoryError", - "Out of memory! (in VMI)."); - break; - case VMI_ERROR_INVALID_METHODID: - JCL_ThrowException (env, "java/lang/InternalError", - "VMI error: INVALID_METHODID"); - break; - case VMI_ERROR_INVALID_CLASS: - JCL_ThrowException (env, "java/lang/InternalError", - "VMI error: INVALID_CLASS"); - break; - case VMI_ERROR_INVALID_BCI: - JCL_ThrowException (env, "java/lang/InternalError", - "VMI error: INVALID_BCI"); - break; - case VMI_ERROR_NO_SUCH_BREAKPOINT: - JCL_ThrowException (env, "java/lang/InternalError", - "VMI error: NO_SUCH_BREAKPOINT"); - break; - case VMI_ERROR_VM_DEAD: - JCL_ThrowException (env, "java/lang/InternalError", - "VMI error: VM Dead! Kinda makes ya wonder how this exception got thrown, huh?"); - break; - case VMI_ERROR_INVALID_FRAMEID: - JCL_ThrowException (env, "java/lang/IllegalThreadStateException", - "NULL Frame ID detected in VMI."); - break; - case VMI_ERROR_INVALID_SLOT: - JCL_ThrowException (env, "java/lang/InternalError", - "VMI error: INVALID_SLOT"); - break; - case VMI_ERROR_TYPE_MISMATCH: - JCL_ThrowException (env, "java/lang/InternalError", - "VMI error: INVALID_SLOT"); - break; - case VMI_ERROR_NATIVE_FRAME: - JCL_ThrowException (env, "java/lang/InternalError", - "VMI error: NATIVE_FRAME"); - break; - case VMI_ERROR_NO_MORE_FRAMES: - JCL_ThrowException (env, "java/lang/InternalError", - "VMI error: NO_MORE_FRAMES"); - break; - case VMI_ERROR_INVALID_THREAD: - JCL_ThrowException (env, "java/lang/IllegalThreadStateException", - "Invalid thread in VMI."); - break; - case VMI_ERROR_THREAD_NOT_SUSPENDED: - JCL_ThrowException (env, "java/lang/IllegalThreadStateException", - "Attempt to introspect unsuspended thread in VMI."); - break; - default: - JCL_ThrowException (env, "java/lang/UnknownError", - "VMI returned erroneous error value ..."); - break; - } +VMI_ThrowAppropriateException(JNIEnv *env, vmiError err) { + switch(err) { + case VMI_ERROR_NONE: + JCL_ThrowException(env, "java/lang/InternalError", "ERROR_NONE passed to VMI exception thrower."); + break; + case VMI_ERROR_NULL_POINTER: + JCL_ThrowException(env, "java/lang/NullPointerException", "null pointer in VMI detected."); + break; + case VMI_ERROR_OUT_OF_MEMORY: + JCL_ThrowException(env, "java/lang/OutOfMemoryError", "Out of memory! (in VMI)."); + break; + case VMI_ERROR_INVALID_METHODID: + JCL_ThrowException(env, "java/lang/InternalError", "VMI error: INVALID_METHODID"); + break; + case VMI_ERROR_INVALID_CLASS: + JCL_ThrowException(env, "java/lang/InternalError", "VMI error: INVALID_CLASS"); + break; + case VMI_ERROR_INVALID_BCI: + JCL_ThrowException(env, "java/lang/InternalError", "VMI error: INVALID_BCI"); + break; + case VMI_ERROR_NO_SUCH_BREAKPOINT: + JCL_ThrowException(env, "java/lang/InternalError", "VMI error: NO_SUCH_BREAKPOINT"); + break; + case VMI_ERROR_VM_DEAD: + JCL_ThrowException(env, "java/lang/InternalError", "VMI error: VM Dead! Kinda makes ya wonder how this exception got thrown, huh?"); + break; + case VMI_ERROR_INVALID_FRAMEID: + JCL_ThrowException(env, "java/lang/IllegalThreadStateException", "NULL Frame ID detected in VMI."); + break; + case VMI_ERROR_INVALID_SLOT: + JCL_ThrowException(env, "java/lang/InternalError", "VMI error: INVALID_SLOT"); + break; + case VMI_ERROR_TYPE_MISMATCH: + JCL_ThrowException(env, "java/lang/InternalError", "VMI error: INVALID_SLOT"); + break; + case VMI_ERROR_NATIVE_FRAME: + JCL_ThrowException(env, "java/lang/InternalError", "VMI error: NATIVE_FRAME"); + break; + case VMI_ERROR_NO_MORE_FRAMES: + JCL_ThrowException(env, "java/lang/InternalError", "VMI error: NO_MORE_FRAMES"); + break; + case VMI_ERROR_INVALID_THREAD: + JCL_ThrowException(env, "java/lang/IllegalThreadStateException", "Invalid thread in VMI."); + break; + case VMI_ERROR_THREAD_NOT_SUSPENDED: + JCL_ThrowException(env, "java/lang/IllegalThreadStateException", "Attempt to introspect unsuspended thread in VMI."); + break; + default: + JCL_ThrowException(env, "java/lang/UnknownError", "VMI returned erroneous error value ..."); + break; + } } + + diff --git a/native/vmi/vmi.h b/native/vmi/vmi.h index e3f866f5e..ea4f51783 100755 --- a/native/vmi/vmi.h +++ b/native/vmi/vmi.h @@ -40,12 +40,10 @@ exception statement from your version. */ #include <jni.h> -typedef void *jframeID; -typedef void *jthread; +typedef void * jframeID; +typedef void * jthread; -typedef enum _vmiError_enum vmiError; -enum _vmiError_enum -{ +typedef enum { VMI_ERROR_NONE, VMI_ERROR_NULL_POINTER, VMI_ERROR_OUT_OF_MEMORY, @@ -61,7 +59,7 @@ enum _vmiError_enum VMI_ERROR_NO_MORE_FRAMES, VMI_ERROR_INVALID_THREAD, VMI_ERROR_THREAD_NOT_SUSPENDED -}; +} vmiError; #define VMI_MOD_PUBLIC 0x0001 @@ -77,17 +75,18 @@ enum _vmiError_enum #define VMI_MOD_ABSTRACT 0x0400 JNIEXPORT vmiError JNICALL -VMI_GetFrameClass (JNIEnv *env, jframeID frame, jobject *obj); +VMI_GetFrameClass(JNIEnv *env, jframeID frame, jobject *obj); JNIEXPORT vmiError JNICALL -VMI_GetFrameObject (JNIEnv *env, jframeID frame, jobject *obj); +VMI_GetFrameObject(JNIEnv *env, jframeID frame, jobject *obj); -JNIEXPORT vmiError JNICALL VMI_GetThisFrame (JNIEnv *env, jframeID *frame); +JNIEXPORT vmiError JNICALL +VMI_GetThisFrame(JNIEnv *env, jframeID *frame); JNIEXPORT vmiError JNICALL -VMI_GetThisThreadObject (JNIEnv *env, jthread *thread); +VMI_GetThisThreadObject(JNIEnv *env, jthread *thread); JNIEXPORT void JNICALL -VMI_ThrowAppropriateException (JNIEnv *env, vmiError err); +VMI_ThrowAppropriateException(JNIEnv *env, vmiError err); #endif |