summaryrefslogtreecommitdiffstats
path: root/libjava/gnu/classpath/jdwp/natVMMethod.cc
blob: 7dea47477312527841d7f79d820ea3dd10a2d963 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// natVMMethod.cc -- native support for VMMethod

/* Copyright (C) 2006 Free Software Foundation

   This file is part of libgcj.

This software is copyrighted work licensed under the terms of the
Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
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>

java::lang::String*
gnu::classpath::jdwp::VMMethod::getName ()
{
  return NULL;
}

java::lang::String*
gnu::classpath::jdwp::VMMethod::getSignature ()
{
  return NULL;
}

jint
gnu::classpath::jdwp::VMMethod::getModifiers ()
{
  return 0;
}

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);
    }

  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);
}


gnu::classpath::jdwp::util::VariableTable*
gnu::classpath::jdwp::VMMethod::getVariableTable ()
{
  return NULL;
}
OpenPOWER on IntegriCloud