* gnu/classpath/jdwp/natVMMethod.cc (getLineTable): Implement.
authorKeith Seitz <keiths@redhat.com>
Thu, 2 Nov 2006 17:01:01 +0000 (17:01 +0000)
committerKeith Seitz <kseitz@gcc.gnu.org>
Thu, 2 Nov 2006 17:01:01 +0000 (17:01 +0000)
From-SVN: r118420

libjava/ChangeLog
libjava/gnu/classpath/jdwp/natVMMethod.cc

index e8348a0a9095e1197c40d94960374a4e704bb6e0..cdbf3da458a2c3a8c8f23c0fb7f82a7e13539dee 100644 (file)
@@ -1,3 +1,7 @@
+2006-11-02  Keith Seitz  <keiths@redhat.com>
+
+       * gnu/classpath/jdwp/natVMMethod.cc (getLineTable): Implement.
+
 2006-11-02  Keith Seitz  <keiths@redhat.com>
 
        * jvmti.cc (_Jv_JVMTI_GetLineNumberTable): New function.
index eb1d6fda0c2443b1c1a461fd156a536a26d14d12..7dea47477312527841d7f79d820ea3dd10a2d963 100644 (file)
@@ -10,8 +10,10 @@ details.  */
 
 #include <config.h>
 #include <gcj/cni.h>
+#include <java-interp.h>
 
 #include <gnu/classpath/jdwp/VMMethod.h>
+#include <gnu/classpath/jdwp/exception/JdwpInternalErrorException.h>
 #include <gnu/classpath/jdwp/util/LineTable.h>
 #include <gnu/classpath/jdwp/util/VariableTable.h>
 
@@ -33,10 +35,44 @@ gnu::classpath::jdwp::VMMethod::getModifiers ()
   return 0;
 }
 
-gnu::classpath::jdwp::util::LineTable*
+gnu::classpath::jdwp::util::LineTable *
 gnu::classpath::jdwp::VMMethod::getLineTable ()
 {
-  return NULL;
+  if (!_Jv_IsInterpretedClass (getDeclaringClass ()))
+    {
+      // this should not happen
+      ::java::lang::String *msg = JvNewStringLatin1 ("native class");
+      throw new exception::JdwpInternalErrorException (msg);
+    }
+
+  jmethodID desired_method = reinterpret_cast<jmethodID> (_methodId);
+
+  _Jv_MethodBase *theMethod
+    = _Jv_FindInterpreterMethod (getDeclaringClass (), desired_method);
+
+  if (theMethod == NULL)
+    {
+      // this should not happen
+      ::java::lang::String *msg
+       = JvNewStringLatin1 ("could not find method in class");
+      throw new exception::JdwpInternalErrorException (msg);
+    }
+
+  if (::java::lang::reflect::Modifier::isNative (desired_method->accflags))
+    {
+      jintArray lines = JvNewIntArray (0);
+      jlongArray indices = JvNewLongArray (0);
+      return new util::LineTable (-1, -1, lines, indices);
+    }
+
+  // get the linetable
+  _Jv_InterpMethod *imeth = reinterpret_cast<_Jv_InterpMethod *> (theMethod);
+  jlong start;
+  jlong end;
+  jintArray lines;
+  jlongArray indices;
+  imeth->get_line_table (start, end, lines, indices);
+  return new util::LineTable (start, end, lines, indices);
 }