aboutsummaryrefslogtreecommitdiff
path: root/libjava/testsuite/libjava.jvmti
diff options
context:
space:
mode:
authorKyle Galloway <kgallowa@redhat.com>2007-02-15 14:49:50 +0000
committerKyle Galloway <kgallowa@gcc.gnu.org>2007-02-15 14:49:50 +0000
commitfc01261a60ff3e7643ff663950020505a6d659d0 (patch)
treeb6fcfec2b20b166cb494d556988e1edde4624e05 /libjava/testsuite/libjava.jvmti
parent02bba3c4176fe3c6055a149d75ad8694a9c01e51 (diff)
downloadgcc-fc01261a60ff3e7643ff663950020505a6d659d0.zip
gcc-fc01261a60ff3e7643ff663950020505a6d659d0.tar.gz
gcc-fc01261a60ff3e7643ff663950020505a6d659d0.tar.bz2
natVMVirtualMachine (getFrames): Implement.
2007-02-15 Kyle Galloway <kgallowa@redhat.com> * gnu/classpath/jdwp/natVMVirtualMachine (getFrames): Implement. From-SVN: r121997
Diffstat (limited to 'libjava/testsuite/libjava.jvmti')
-rw-r--r--libjava/testsuite/libjava.jvmti/interp/getlocalvartable.h19
-rw-r--r--libjava/testsuite/libjava.jvmti/interp/getlocalvartable.jarbin0 -> 1370 bytes
-rw-r--r--libjava/testsuite/libjava.jvmti/interp/getlocalvartable.java63
-rw-r--r--libjava/testsuite/libjava.jvmti/interp/getlocalvartable.out109
-rw-r--r--libjava/testsuite/libjava.jvmti/interp/natgetlocalvartable.cc67
5 files changed, 258 insertions, 0 deletions
diff --git a/libjava/testsuite/libjava.jvmti/interp/getlocalvartable.h b/libjava/testsuite/libjava.jvmti/interp/getlocalvartable.h
new file mode 100644
index 0000000..8d4cb3b
--- /dev/null
+++ b/libjava/testsuite/libjava.jvmti/interp/getlocalvartable.h
@@ -0,0 +1,19 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+
+#ifndef __getlocalvartable__
+#define __getlocalvartable__
+
+#include <jni.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+JNIEXPORT jint JNICALL Java_getlocalvartable_do_1getlocalvartable_1tests (JNIEnv *env, jclass);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __getlocalvartable__ */
diff --git a/libjava/testsuite/libjava.jvmti/interp/getlocalvartable.jar b/libjava/testsuite/libjava.jvmti/interp/getlocalvartable.jar
new file mode 100644
index 0000000..9fffb92
--- /dev/null
+++ b/libjava/testsuite/libjava.jvmti/interp/getlocalvartable.jar
Binary files differ
diff --git a/libjava/testsuite/libjava.jvmti/interp/getlocalvartable.java b/libjava/testsuite/libjava.jvmti/interp/getlocalvartable.java
new file mode 100644
index 0000000..e0f3b31
--- /dev/null
+++ b/libjava/testsuite/libjava.jvmti/interp/getlocalvartable.java
@@ -0,0 +1,63 @@
+public class getlocalvartable
+{
+ public boolean done = false;
+
+ // num_frames is the number of frames > the original run () call so if
+ // num_frames = 1, the thread will have 2 frames, the original Thread.run
+ // call, plus one additional
+ public int num_frames, thread_num;
+
+ public static int num_threads = 1;
+
+ static
+ {
+ System.loadLibrary("natgetlocalvartable");
+ }
+
+ public double aMethod (float pone, float ptwo)
+ {
+ float fone, ftwo;
+ double done, dtwo;
+
+ fone = pone;
+ ftwo = 2 * ptwo;
+
+ done = 5 * fone;
+ dtwo = 6 * ftwo;
+
+ return done + dtwo;
+ }
+
+ public long bMethod (int ipone, int iptwo)
+ {
+ int ione, itwo;
+ long lone, ltwo;
+
+ ione = ipone;
+ itwo = 5 * iptwo;
+
+ lone = ione;
+ ltwo = 8 * itwo;
+
+ return lone + ltwo;
+ }
+
+ public Object cMethod (Object op)
+ {
+ Object oone, otwo;
+ oone = op;
+ otwo = oone;
+ oone = null;
+
+ return otwo;
+ }
+
+ public static native int do_getlocalvartable_tests ();
+
+ public static void main (String[] args)
+ {
+ System.out.println ("JVMTI getlocalvartable Interpreted Test");
+
+ do_getlocalvartable_tests ();
+ }
+}
diff --git a/libjava/testsuite/libjava.jvmti/interp/getlocalvartable.out b/libjava/testsuite/libjava.jvmti/interp/getlocalvartable.out
new file mode 100644
index 0000000..2e0ec40
--- /dev/null
+++ b/libjava/testsuite/libjava.jvmti/interp/getlocalvartable.out
@@ -0,0 +1,109 @@
+JVMTI getlocalvartable Interpreted Test
+Slot: 0
+ Name: this
+ Sig: Lgetlocalvartable;
+ Gen Sig: Lgetlocalvartable;
+ Start Loc: 0
+ Length: 28
+Slot: 1
+ Name: pone
+ Sig: F
+ Gen Sig: F
+ Start Loc: 0
+ Length: 28
+Slot: 2
+ Name: ptwo
+ Sig: F
+ Gen Sig: F
+ Start Loc: 0
+ Length: 28
+Slot: 3
+ Name: fone
+ Sig: F
+ Gen Sig: F
+ Start Loc: 2
+ Length: 26
+Slot: 4
+ Name: ftwo
+ Sig: F
+ Gen Sig: F
+ Start Loc: 7
+ Length: 21
+Slot: 5
+ Name: done
+ Sig: D
+ Gen Sig: D
+ Start Loc: 14
+ Length: 14
+Slot: 7
+ Name: dtwo
+ Sig: D
+ Gen Sig: D
+ Start Loc: 22
+ Length: 6
+Slot: 0
+ Name: this
+ Sig: Lgetlocalvartable;
+ Gen Sig: Lgetlocalvartable;
+ Start Loc: 0
+ Length: 25
+Slot: 1
+ Name: ipone
+ Sig: I
+ Gen Sig: I
+ Start Loc: 0
+ Length: 25
+Slot: 2
+ Name: iptwo
+ Sig: I
+ Gen Sig: I
+ Start Loc: 0
+ Length: 25
+Slot: 3
+ Name: ione
+ Sig: I
+ Gen Sig: I
+ Start Loc: 2
+ Length: 23
+Slot: 4
+ Name: itwo
+ Sig: I
+ Gen Sig: I
+ Start Loc: 7
+ Length: 18
+Slot: 5
+ Name: lone
+ Sig: J
+ Gen Sig: J
+ Start Loc: 11
+ Length: 14
+Slot: 7
+ Name: ltwo
+ Sig: J
+ Gen Sig: J
+ Start Loc: 19
+ Length: 6
+Slot: 0
+ Name: this
+ Sig: Lgetlocalvartable;
+ Gen Sig: Lgetlocalvartable;
+ Start Loc: 0
+ Length: 8
+Slot: 1
+ Name: op
+ Sig: Ljava/lang/Object;
+ Gen Sig: Ljava/lang/Object;
+ Start Loc: 0
+ Length: 8
+Slot: 2
+ Name: oone
+ Sig: Ljava/lang/Object;
+ Gen Sig: Ljava/lang/Object;
+ Start Loc: 2
+ Length: 6
+Slot: 3
+ Name: otwo
+ Sig: Ljava/lang/Object;
+ Gen Sig: Ljava/lang/Object;
+ Start Loc: 4
+ Length: 4
diff --git a/libjava/testsuite/libjava.jvmti/interp/natgetlocalvartable.cc b/libjava/testsuite/libjava.jvmti/interp/natgetlocalvartable.cc
new file mode 100644
index 0000000..3ca112d
--- /dev/null
+++ b/libjava/testsuite/libjava.jvmti/interp/natgetlocalvartable.cc
@@ -0,0 +1,67 @@
+#include <jni.h>
+
+#include <jvmti.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "getlocalvartable.h"
+
+JNIEXPORT jint JNICALL Java_getlocalvartable_do_1getlocalvartable_1tests
+(JNIEnv *env, jclass klass)
+{
+ JavaVM *vm;
+ jint err = env->GetJavaVM (&vm);
+ if (err < 0)
+ {
+ fprintf (stderr, "error getting VM\n");
+ exit (1);
+ }
+
+ jvmtiEnv *jvmti = NULL;
+ vm->GetEnv ((void **) &jvmti, JVMTI_VERSION_1_0);
+
+ if (jvmti == NULL)
+ {
+ fprintf (stderr, "error getting jvmti environment\n");
+ exit (1);
+ }
+
+ jint entrys;
+ jvmtiLocalVariableEntry *var_table;
+
+ jvmtiError jerr;
+
+ jmethodID meth_ids[3];
+
+ meth_ids[0] = env->GetMethodID (klass, "aMethod", "(FF)D");
+ meth_ids[1] = env->GetMethodID (klass, "bMethod", "(II)J");
+ meth_ids[2] = env->GetMethodID (klass, "cMethod",
+ "(Ljava/lang/Object;)Ljava/lang/Object;");
+ for (int i = 0; i < 3; i++)
+ {
+ jerr = jvmti->GetLocalVariableTable (meth_ids[i], &entrys, &var_table);
+ if (jerr != JVMTI_ERROR_NONE)
+ {
+ char *error_name;
+ jvmti->GetErrorName (jerr, &error_name);
+ fprintf (stderr, "JVMTI Error: %s\n", error_name);
+ jvmti->Deallocate (reinterpret_cast<unsigned char *> (error_name));
+ }
+ else
+ {
+ for (int j = 0; j < entrys; j++)
+ {
+ printf ("Slot: %d\n", static_cast<int> (var_table[j].slot));
+ printf (" Name: %s\n", var_table[j].name);
+ printf (" Sig: %s\n", var_table[j].signature);
+ printf (" Gen Sig: %s\n", var_table[j].generic_signature);
+ printf (" Start Loc: %ld\n", static_cast<long> (var_table[j].start_location));
+ printf (" Length: %d\n", static_cast<int> (var_table[j].length));
+ }
+
+ jvmti->Deallocate (reinterpret_cast<unsigned char *> (var_table));
+ }
+ }
+
+ return 0;
+}