OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [libjava/] [classpath/] [gnu/] [classpath/] [jdwp/] [processor/] [MethodCommandSet.java] - Blame information for rev 14

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 14 jlechner
/* MethodCommandSet.java -- class to implement the Method Command Set
2
   Copyright (C) 2005 Free Software Foundation
3
 
4
This file is part of GNU Classpath.
5
 
6
GNU Classpath is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 2, or (at your option)
9
any later version.
10
 
11
GNU Classpath is distributed in the hope that it will be useful, but
12
WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
General Public License for more details.
15
 
16
You should have received a copy of the GNU General Public License
17
along with GNU Classpath; see the file COPYING.  If not, write to the
18
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19
02110-1301 USA.
20
 
21
Linking this library statically or dynamically with other modules is
22
making a combined work based on this library.  Thus, the terms and
23
conditions of the GNU General Public License cover the whole
24
combination.
25
 
26
As a special exception, the copyright holders of this library give you
27
permission to link this library with independent modules to produce an
28
executable, regardless of the license terms of these independent
29
modules, and to copy and distribute the resulting executable under
30
terms of your choice, provided that you also meet, for each linked
31
independent module, the terms and conditions of the license of that
32
module.  An independent module is a module which is not derived from
33
or based on this library.  If you modify this library, you may extend
34
this exception to your version of the library, but you are not
35
obligated to do so.  If you do not wish to do so, delete this
36
exception statement from your version. */
37
 
38
 
39
package gnu.classpath.jdwp.processor;
40
 
41
import gnu.classpath.jdwp.JdwpConstants;
42
import gnu.classpath.jdwp.VMVirtualMachine;
43
import gnu.classpath.jdwp.exception.JdwpException;
44
import gnu.classpath.jdwp.exception.JdwpInternalErrorException;
45
import gnu.classpath.jdwp.exception.NotImplementedException;
46
import gnu.classpath.jdwp.id.ObjectId;
47
import gnu.classpath.jdwp.id.ReferenceTypeId;
48
import gnu.classpath.jdwp.util.LineTable;
49
import gnu.classpath.jdwp.util.VariableTable;
50
 
51
import java.io.DataOutputStream;
52
import java.io.IOException;
53
import java.lang.reflect.Method;
54
import java.nio.ByteBuffer;
55
 
56
/**
57
 * A class representing the Method Command Set.
58
 *
59
 * @author Aaron Luchko <aluchko@redhat.com>
60
 */
61
public class MethodCommandSet
62
  extends CommandSet
63
{
64
  public boolean runCommand(ByteBuffer bb, DataOutputStream os, byte command)
65
      throws JdwpException
66
  {
67
    try
68
      {
69
        switch (command)
70
          {
71
          case JdwpConstants.CommandSet.Method.LINE_TABLE:
72
            executeLineTable(bb, os);
73
            break;
74
          case JdwpConstants.CommandSet.Method.VARIABLE_TABLE:
75
            executeVariableTable(bb, os);
76
            break;
77
          case JdwpConstants.CommandSet.Method.BYTE_CODES:
78
            executeByteCodes(bb, os);
79
            break;
80
          case JdwpConstants.CommandSet.Method.IS_OBSOLETE:
81
            executeIsObsolete(bb, os);
82
            break;
83
          case JdwpConstants.CommandSet.Method.VARIABLE_TABLE_WITH_GENERIC:
84
            executeVariableTableWithGeneric(bb, os);
85
            break;
86
          default:
87
            throw new NotImplementedException(
88
              "Command " + command + " not found in Method Command Set.");
89
          }
90
      }
91
    catch (IOException ex)
92
      {
93
        // The DataOutputStream we're using isn't talking to a socket at all
94
        // So if we throw an IOException we're in serious trouble
95
        throw new JdwpInternalErrorException(ex);
96
      }
97
 
98
    return false;
99
  }
100
 
101
  private void executeLineTable(ByteBuffer bb, DataOutputStream os)
102
      throws JdwpException, IOException
103
  {
104
    ReferenceTypeId refId = idMan.readReferenceTypeId(bb);
105
    Class clazz = refId.getType();
106
 
107
    ObjectId oid = idMan.readObjectId(bb);
108
    Method method = (Method) oid.getObject();
109
 
110
    LineTable lt = VMVirtualMachine.getLineTable(clazz, method);
111
    lt.write(os);
112
  }
113
 
114
  private void executeVariableTable(ByteBuffer bb, DataOutputStream os)
115
      throws JdwpException, IOException
116
  {
117
    ReferenceTypeId refId = idMan.readReferenceTypeId(bb);
118
    Class clazz = refId.getType();
119
 
120
    ObjectId oid = idMan.readObjectId(bb);
121
    Method method = (Method) oid.getObject();
122
 
123
    VariableTable vt = VMVirtualMachine.getVarTable(clazz, method);
124
    vt.write(os);
125
  }
126
 
127
  private void executeByteCodes(ByteBuffer bb, DataOutputStream os)
128
      throws JdwpException
129
  {
130
    // This command is optional, determined by VirtualMachines CapabilitiesNew
131
    // so we'll leave it till later to implement
132
    throw new NotImplementedException("Command ByteCodes not implemented.");
133
  }
134
 
135
  private void executeIsObsolete(ByteBuffer bb, DataOutputStream os)
136
      throws IOException
137
  {
138
    // The debugger is really asking if this method has been redefined using
139
    // VirtualMachineCommandSet.RedefineClasses. Since we don't implement that
140
    // command the answer to this will always be false.
141
    os.writeBoolean(false);
142
  }
143
 
144
  private void executeVariableTableWithGeneric(ByteBuffer bb,
145
                                               DataOutputStream os)
146
      throws JdwpException
147
  {
148
    // We don't have generics yet
149
    throw new NotImplementedException(
150
      "Command SourceDebugExtension not implemented.");
151
  }
152
 
153
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.