aboutsummaryrefslogtreecommitdiff
path: root/libjava
diff options
context:
space:
mode:
authorKyle Galloway <kgallowa@redhat.com>2007-03-06 21:09:22 +0000
committerKyle Galloway <kgallowa@redhat.com>2007-03-06 21:09:22 +0000
commit036dfc5eb1406c809f2dbeeff1ff74d9fa91db89 (patch)
tree25678aef2a45acd45c767382e46815681d2d1b06 /libjava
parent005d8d8cfd439d0a8feba3e90fe066503dcf97df (diff)
2007-03-06 Kyle Galloway <kgallowa@redhat.com>
* classpath/gnu/classpath/jdwp/exception/AbsentInformationException.java: New file. * classpath/lib/gnu/classpath/jdwp/exception/AbsentInformationException.class: Ditto. * gnu/classpath/jdwp/exception/AbsentInformationException.h: Ditto. * gnu/classpath/jdwp/natVMMethod.cc: Add CHECK_INTERP_CLASS macro. (VMMethod::getLineTable): Use new macro. (VMMethod::getVariableTable): Implement. * sources.am: Regenerated. * Makefile.in: Ditto. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@122639 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava')
-rw-r--r--libjava/ChangeLog11
-rw-r--r--libjava/Makefile.in1
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/exception/AbsentInformationException.java56
-rw-r--r--libjava/classpath/lib/gnu/classpath/jdwp/exception/AbsentInformationException.classbin0 -> 474 bytes
-rw-r--r--libjava/gnu/classpath/jdwp/exception/AbsentInformationException.h35
-rw-r--r--libjava/gnu/classpath/jdwp/natVMMethod.cc97
-rw-r--r--libjava/sources.am1
7 files changed, 194 insertions, 7 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 2707712c33d..278642f62f4 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,14 @@
+2007-03-06 Kyle Galloway <kgallowa@redhat.com>
+
+ * classpath/gnu/classpath/jdwp/exception/AbsentInformationException.java: New file.
+ * classpath/lib/gnu/classpath/jdwp/exception/AbsentInformationException.class: Ditto.
+ * gnu/classpath/jdwp/exception/AbsentInformationException.h: Ditto.
+ * gnu/classpath/jdwp/natVMMethod.cc: Add CHECK_INTERP_CLASS macro.
+ (VMMethod::getLineTable): Use new macro.
+ (VMMethod::getVariableTable): Implement.
+ * sources.am: Regenerated.
+ * Makefile.in: Ditto.
+
2007-03-06 Tom Tromey <tromey@redhat.com>
* Makefile.in: Rebuilt.
diff --git a/libjava/Makefile.in b/libjava/Makefile.in
index e2e26d8f835..a7ba68c44ee 100644
--- a/libjava/Makefile.in
+++ b/libjava/Makefile.in
@@ -1208,6 +1208,7 @@ classpath/gnu/classpath/jdwp/event/filters/ThreadOnlyFilter.java
gnu_classpath_jdwp_event_filters_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_classpath_jdwp_event_filters_source_files)))
gnu_classpath_jdwp_exception_source_files = \
+classpath/gnu/classpath/jdwp/exception/AbsentInformationException.java \
classpath/gnu/classpath/jdwp/exception/InvalidClassException.java \
classpath/gnu/classpath/jdwp/exception/InvalidClassLoaderException.java \
classpath/gnu/classpath/jdwp/exception/InvalidCountException.java \
diff --git a/libjava/classpath/gnu/classpath/jdwp/exception/AbsentInformationException.java b/libjava/classpath/gnu/classpath/jdwp/exception/AbsentInformationException.java
new file mode 100644
index 00000000000..5bf383f5841
--- /dev/null
+++ b/libjava/classpath/gnu/classpath/jdwp/exception/AbsentInformationException.java
@@ -0,0 +1,56 @@
+/* AbsentInformationException.java -- information not present exception
+ Copyright (C) 2007 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.classpath.jdwp.exception;
+
+import gnu.classpath.jdwp.JdwpConstants;
+
+/**
+ * An exception thrown when the requested information is not available.
+ *
+ * @author Kyle Galloway (kgallowa@redhat.com)
+ */
+public class AbsentInformationException
+ extends JdwpException
+{
+ public AbsentInformationException(String str)
+ {
+ super(JdwpConstants.Error.ABSENT_INFORMATION, str);
+ }
+}
diff --git a/libjava/classpath/lib/gnu/classpath/jdwp/exception/AbsentInformationException.class b/libjava/classpath/lib/gnu/classpath/jdwp/exception/AbsentInformationException.class
new file mode 100644
index 00000000000..19de3378fef
--- /dev/null
+++ b/libjava/classpath/lib/gnu/classpath/jdwp/exception/AbsentInformationException.class
Binary files differ
diff --git a/libjava/gnu/classpath/jdwp/exception/AbsentInformationException.h b/libjava/gnu/classpath/jdwp/exception/AbsentInformationException.h
new file mode 100644
index 00000000000..bb4c699553d
--- /dev/null
+++ b/libjava/gnu/classpath/jdwp/exception/AbsentInformationException.h
@@ -0,0 +1,35 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __gnu_classpath_jdwp_exception_AbsentInformationException__
+#define __gnu_classpath_jdwp_exception_AbsentInformationException__
+
+#pragma interface
+
+#include <gnu/classpath/jdwp/exception/JdwpException.h>
+extern "Java"
+{
+ namespace gnu
+ {
+ namespace classpath
+ {
+ namespace jdwp
+ {
+ namespace exception
+ {
+ class AbsentInformationException;
+ }
+ }
+ }
+ }
+}
+
+class gnu::classpath::jdwp::exception::AbsentInformationException : public ::gnu::classpath::jdwp::exception::JdwpException
+{
+
+public:
+ AbsentInformationException(::java::lang::String *);
+ static ::java::lang::Class class$;
+};
+
+#endif // __gnu_classpath_jdwp_exception_AbsentInformationException__
diff --git a/libjava/gnu/classpath/jdwp/natVMMethod.cc b/libjava/gnu/classpath/jdwp/natVMMethod.cc
index 07d5622c704..76fd0a64168 100644
--- a/libjava/gnu/classpath/jdwp/natVMMethod.cc
+++ b/libjava/gnu/classpath/jdwp/natVMMethod.cc
@@ -15,10 +15,25 @@ details. */
#include "jvmti-int.h"
#include <gnu/classpath/jdwp/VMMethod.h>
+#include <gnu/classpath/jdwp/exception/AbsentInformationException.h>
+#include <gnu/classpath/jdwp/exception/InvalidMethodException.h>
#include <gnu/classpath/jdwp/exception/JdwpInternalErrorException.h>
#include <gnu/classpath/jdwp/util/LineTable.h>
#include <gnu/classpath/jdwp/util/VariableTable.h>
+using namespace java::lang;
+
+#define CHECK_INTERP_CLASS() \
+do \
+ { \
+ if (!_Jv_IsInterpretedClass (getDeclaringClass ())) \
+ { \
+ ::java::lang::String *msg = JvNewStringLatin1 ("native class"); \
+ throw new exception::JdwpInternalErrorException (msg); \
+ } \
+ } \
+while (0)
+
jstring
gnu::classpath::jdwp::VMMethod::getName ()
{
@@ -56,12 +71,7 @@ gnu::classpath::jdwp::VMMethod::getModifiers ()
gnu::classpath::jdwp::util::LineTable *
gnu::classpath::jdwp::VMMethod::getLineTable ()
{
- if (!_Jv_IsInterpretedClass (getDeclaringClass ()))
- {
- // this should not happen
- ::java::lang::String *msg = JvNewStringLatin1 ("native class");
- throw new exception::JdwpInternalErrorException (msg);
- }
+ CHECK_INTERP_CLASS ();
jmethodID desired_method = reinterpret_cast<jmethodID> (_methodId);
@@ -97,5 +107,78 @@ gnu::classpath::jdwp::VMMethod::getLineTable ()
gnu::classpath::jdwp::util::VariableTable*
gnu::classpath::jdwp::VMMethod::getVariableTable ()
{
- return NULL;
+ using namespace gnu::classpath::jdwp::util;
+
+ jvmtiEnv *env = _Jv_GetJDWP_JVMTIEnv ();
+
+ CHECK_INTERP_CLASS ();
+
+ jmethodID meth = reinterpret_cast<jmethodID> (_methodId);
+ jvmtiLocalVariableEntry *var_table;
+ jint num_slots, args_len;
+
+ jvmtiError jerr = env->GetLocalVariableTable (meth, &num_slots, &var_table);
+
+ if (jerr != JVMTI_ERROR_NONE)
+ goto error;
+
+ jerr = env->GetArgumentsSize (meth, &args_len);
+
+ if (jerr != JVMTI_ERROR_NONE)
+ {
+ error:
+ using namespace gnu::classpath::jdwp::exception;
+ char *error;
+ env->GetErrorName (jerr, &error);
+ String *msg = JvNewStringUTF (error);
+ env->Deallocate (reinterpret_cast<unsigned char *> (error));
+
+ if (jerr == JVMTI_ERROR_NATIVE_METHOD)
+ throw new AbsentInformationException (msg);
+ else if (jerr == JVMTI_ERROR_INVALID_METHODID)
+ throw new InvalidMethodException (_methodId);
+ else
+ throw new JdwpInternalErrorException (msg);
+ }
+
+ jlongArray start_pcs = JvNewLongArray (num_slots);
+ jlong *start_pcs_ptr = elements (start_pcs);
+ jintArray lengths = JvNewIntArray (num_slots);
+ jint *lengths_ptr = elements (lengths);
+ jintArray slots = JvNewIntArray (num_slots);
+ jint *slots_ptr = elements (slots);
+ JArray<String *> *names = reinterpret_cast<JArray<String *> *>
+ (JvNewObjectArray (num_slots,
+ &String::class$, NULL));
+ jstring *names_ptr = elements (names);
+ JArray<String *> *signatures = reinterpret_cast<JArray<String *> *>
+ (JvNewObjectArray (num_slots,
+ &String::class$, NULL));
+ jstring *signatures_ptr = elements (signatures);
+
+ // Get the information out of the JVMTI strucutre and Deallocate the strings.
+ for (int i = 0; i < num_slots; i++)
+ {
+ start_pcs_ptr[i] = var_table[i].start_location;
+ lengths_ptr[i] = var_table[i].length;
+ slots_ptr[i] = var_table[i].slot;
+ names_ptr[i] = JvNewStringUTF (var_table[i].name);
+ env->Deallocate (reinterpret_cast<unsigned char *>
+ (var_table[i].name));
+ signatures_ptr[i] = JvNewStringUTF (var_table[i].signature);
+ env->Deallocate (reinterpret_cast<unsigned char *>
+ (var_table[i].signature));
+ env->Deallocate (reinterpret_cast<unsigned char *>
+ (var_table[i].generic_signature));
+ }
+
+ // Now Deallocate the table since it's strings have already been freed.
+ env->Deallocate (reinterpret_cast<unsigned char *> (var_table));
+
+ // Create the new JDWP VariableTable to return with the now filled arrays.
+ VariableTable* jdwp_vtable = new VariableTable (args_len, num_slots,
+ start_pcs, names, signatures,
+ lengths, slots);
+
+ return jdwp_vtable;
}
diff --git a/libjava/sources.am b/libjava/sources.am
index 4bf9956f161..e1e8aed5603 100644
--- a/libjava/sources.am
+++ b/libjava/sources.am
@@ -326,6 +326,7 @@ gnu/classpath/jdwp/event/filters.list: $(gnu_classpath_jdwp_event_filters_source
gnu_classpath_jdwp_exception_source_files = \
+classpath/gnu/classpath/jdwp/exception/AbsentInformationException.java \
classpath/gnu/classpath/jdwp/exception/InvalidClassException.java \
classpath/gnu/classpath/jdwp/exception/InvalidClassLoaderException.java \
classpath/gnu/classpath/jdwp/exception/InvalidCountException.java \