You are viewing a plain text version of this content. The canonical link for it is here.
Posted to kato-commits@incubator.apache.org by mo...@apache.org on 2009/08/25 15:41:25 UTC
svn commit: r807673 [1/2] - in
/incubator/kato/trunk/org.apache.kato/kato.cjvmti: ./ .settings/ META-INF/
META-INF/services/ src/ src/main/ src/main/java/ src/main/java/org/
src/main/java/org/apache/ src/main/java/org/apache/kato/
src/main/java/org/apa...
Author: monteith
Date: Tue Aug 25 15:41:23 2009
New Revision: 807673
URL: http://svn.apache.org/viewvc?rev=807673&view=rev
Log:
Commiting contribution from Paul Sobek from JIRA Issue KATO-10
Added:
incubator/kato/trunk/org.apache.kato/kato.cjvmti/
incubator/kato/trunk/org.apache.kato/kato.cjvmti/.classpath (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/.project (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/.settings/
incubator/kato/trunk/org.apache.kato/kato.cjvmti/.settings/org.eclipse.jdt.core.prefs (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/.settings/org.maven.ide.eclipse.prefs (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/META-INF/
incubator/kato/trunk/org.apache.kato/kato.cjvmti/META-INF/services/
incubator/kato/trunk/org.apache.kato/kato.cjvmti/META-INF/services/javax.tools.diagnostics.image.ImageFactory
incubator/kato/trunk/org.apache.kato/kato.cjvmti/pom.xml (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/
incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/
incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/
incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/
incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/
incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/
incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/
incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/
incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/JavaRuntimeImpl.java (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/
incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JClass.java (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JClassLoader.java (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JField.java (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JFieldValue.java (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JLocalVariable.java (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JLocalVariableTableEntry.java (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JLocation.java (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JMethod.java (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JMonitor.java (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JObject.java (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JStackFrame.java (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JThread.java (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JValueHolder.java (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/Model.java (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/ObjectMapList.java (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/SimpleImagePointer.java (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/process/
incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/process/ImageFactoryImpl.java (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/process/ImageImpl.java (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/reader/
incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/reader/CJVMTIBinReader.java (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/reader/CLogger.java (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/resources/
incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/test/
incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/test/java/
incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/test/resources/
incubator/kato/trunk/org.apache.kato/kato.cjvmti/target/
incubator/kato/trunk/org.apache.kato/kato.cjvmti/target/classes/
incubator/kato/trunk/org.apache.kato/kato.cjvmti/target/classes/org/
incubator/kato/trunk/org.apache.kato/kato.cjvmti/target/classes/org/apache/
incubator/kato/trunk/org.apache.kato/kato.cjvmti/target/classes/org/apache/kato/
incubator/kato/trunk/org.apache.kato/kato.cjvmti/target/classes/org/apache/kato/jvmti/
incubator/kato/trunk/org.apache.kato/kato.cjvmti/target/classes/org/apache/kato/jvmti/javaruntime/
incubator/kato/trunk/org.apache.kato/kato.cjvmti/target/classes/org/apache/kato/jvmti/javaruntime/JavaRuntimeImpl.class (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/target/classes/org/apache/kato/jvmti/javaruntime/model/
incubator/kato/trunk/org.apache.kato/kato.cjvmti/target/classes/org/apache/kato/jvmti/javaruntime/model/JClass.class (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/target/classes/org/apache/kato/jvmti/javaruntime/model/JClassLoader.class (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/target/classes/org/apache/kato/jvmti/javaruntime/model/JField.class (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/target/classes/org/apache/kato/jvmti/javaruntime/model/JFieldValue.class (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/target/classes/org/apache/kato/jvmti/javaruntime/model/JLocalVariable.class (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/target/classes/org/apache/kato/jvmti/javaruntime/model/JLocalVariableTableEntry.class (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/target/classes/org/apache/kato/jvmti/javaruntime/model/JLocation.class (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/target/classes/org/apache/kato/jvmti/javaruntime/model/JMethod.class (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/target/classes/org/apache/kato/jvmti/javaruntime/model/JMonitor.class (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/target/classes/org/apache/kato/jvmti/javaruntime/model/JObject.class (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/target/classes/org/apache/kato/jvmti/javaruntime/model/JStackFrame.class (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/target/classes/org/apache/kato/jvmti/javaruntime/model/JThread$1.class (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/target/classes/org/apache/kato/jvmti/javaruntime/model/JThread.class (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/target/classes/org/apache/kato/jvmti/javaruntime/model/JValueHolder.class (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/target/classes/org/apache/kato/jvmti/javaruntime/model/Model.class (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/target/classes/org/apache/kato/jvmti/javaruntime/model/ObjectMapList.class (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/target/classes/org/apache/kato/jvmti/javaruntime/model/SimpleImagePointer.class (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/target/classes/org/apache/kato/jvmti/process/
incubator/kato/trunk/org.apache.kato/kato.cjvmti/target/classes/org/apache/kato/jvmti/process/ImageFactoryImpl.class (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/target/classes/org/apache/kato/jvmti/process/ImageImpl$ImageAddressSpaceImpl$ImageProcessImpl.class (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/target/classes/org/apache/kato/jvmti/process/ImageImpl$ImageAddressSpaceImpl.class (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/target/classes/org/apache/kato/jvmti/process/ImageImpl.class (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/target/classes/org/apache/kato/jvmti/reader/
incubator/kato/trunk/org.apache.kato/kato.cjvmti/target/classes/org/apache/kato/jvmti/reader/CJVMTIBinReader$VariableValue.class (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/target/classes/org/apache/kato/jvmti/reader/CJVMTIBinReader.class (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/target/classes/org/apache/kato/jvmti/reader/CLogger.class (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/target/kato.jvmti-0.0.1-SNAPSHOT.jar (with props)
incubator/kato/trunk/org.apache.kato/kato.cjvmti/target/maven-archiver/
incubator/kato/trunk/org.apache.kato/kato.cjvmti/target/maven-archiver/pom.properties
incubator/kato/trunk/org.apache.kato/kato.cjvmti/target/test-classes/
Added: incubator/kato/trunk/org.apache.kato/kato.cjvmti/.classpath
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.cjvmti/.classpath?rev=807673&view=auto
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.cjvmti/.classpath (added)
+++ incubator/kato/trunk/org.apache.kato/kato.cjvmti/.classpath Tue Aug 25 15:41:23 2009
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="target/classes" path="src/main/java"/>
+ <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+ <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
Propchange: incubator/kato/trunk/org.apache.kato/kato.cjvmti/.classpath
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/kato/trunk/org.apache.kato/kato.cjvmti/.project
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.cjvmti/.project?rev=807673&view=auto
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.cjvmti/.project (added)
+++ incubator/kato/trunk/org.apache.kato/kato.cjvmti/.project Tue Aug 25 15:41:23 2009
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>kato.cjvmti</name>
+ <comment>Apache Kato</comment>
+ <projects>
+ <project>kato.api</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.maven.ide.eclipse.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>
+ </natures>
+</projectDescription>
Propchange: incubator/kato/trunk/org.apache.kato/kato.cjvmti/.project
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/kato/trunk/org.apache.kato/kato.cjvmti/.settings/org.eclipse.jdt.core.prefs
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.cjvmti/.settings/org.eclipse.jdt.core.prefs?rev=807673&view=auto
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.cjvmti/.settings/org.eclipse.jdt.core.prefs (added)
+++ incubator/kato/trunk/org.apache.kato/kato.cjvmti/.settings/org.eclipse.jdt.core.prefs Tue Aug 25 15:41:23 2009
@@ -0,0 +1,12 @@
+#Fri Aug 21 11:56:18 BST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
Propchange: incubator/kato/trunk/org.apache.kato/kato.cjvmti/.settings/org.eclipse.jdt.core.prefs
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/kato/trunk/org.apache.kato/kato.cjvmti/.settings/org.maven.ide.eclipse.prefs
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.cjvmti/.settings/org.maven.ide.eclipse.prefs?rev=807673&view=auto
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.cjvmti/.settings/org.maven.ide.eclipse.prefs (added)
+++ incubator/kato/trunk/org.apache.kato/kato.cjvmti/.settings/org.maven.ide.eclipse.prefs Tue Aug 25 15:41:23 2009
@@ -0,0 +1,9 @@
+#Sat May 23 12:55:11 BST 2009
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+skipCompilerPlugin=true
+version=1
Propchange: incubator/kato/trunk/org.apache.kato/kato.cjvmti/.settings/org.maven.ide.eclipse.prefs
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/kato/trunk/org.apache.kato/kato.cjvmti/META-INF/services/javax.tools.diagnostics.image.ImageFactory
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.cjvmti/META-INF/services/javax.tools.diagnostics.image.ImageFactory?rev=807673&view=auto
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.cjvmti/META-INF/services/javax.tools.diagnostics.image.ImageFactory (added)
+++ incubator/kato/trunk/org.apache.kato/kato.cjvmti/META-INF/services/javax.tools.diagnostics.image.ImageFactory Tue Aug 25 15:41:23 2009
@@ -0,0 +1 @@
+org.apache.kato.jvmti.process.ImageFactoryImpl
\ No newline at end of file
Added: incubator/kato/trunk/org.apache.kato/kato.cjvmti/pom.xml
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.cjvmti/pom.xml?rev=807673&view=auto
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.cjvmti/pom.xml (added)
+++ incubator/kato/trunk/org.apache.kato/kato.cjvmti/pom.xml Tue Aug 25 15:41:23 2009
@@ -0,0 +1,29 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>kato</artifactId>
+ <groupId>org.apache.kato</groupId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.kato</groupId>
+ <artifactId>kato.jvmti</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.kato</groupId>
+ <artifactId>kato.api</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>1.3</version>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Propchange: incubator/kato/trunk/org.apache.kato/kato.cjvmti/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/JavaRuntimeImpl.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/JavaRuntimeImpl.java?rev=807673&view=auto
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/JavaRuntimeImpl.java (added)
+++ incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/JavaRuntimeImpl.java Tue Aug 25 15:41:23 2009
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+package org.apache.kato.jvmti.javaruntime;
+
+import java.io.IOException;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.logging.Level;
+
+import javax.tools.diagnostics.image.CorruptDataException;
+import javax.tools.diagnostics.image.DataUnavailable;
+import javax.tools.diagnostics.image.ImagePointer;
+import javax.tools.diagnostics.image.MemoryAccessException;
+import javax.tools.diagnostics.runtime.java.JavaObject;
+import javax.tools.diagnostics.runtime.java.JavaRuntime;
+import javax.tools.diagnostics.runtime.java.JavaVMInitArgs;
+
+import org.apache.kato.jvmti.javaruntime.model.Model;
+import org.apache.kato.jvmti.reader.CLogger;
+
+public class JavaRuntimeImpl implements JavaRuntime {
+
+
+ private Model base=null;
+
+ public JavaRuntimeImpl(Model m) throws IOException {
+ this.base=m;
+
+ }
+
+ @Override
+ public List getCompiledMethods() {
+ return new LinkedList();
+ }
+
+ @Override
+ public List getHeapRoots() {
+ return new LinkedList();
+ }
+
+ @Override
+ public List getHeaps() {
+ return new LinkedList();
+ }
+
+ @Override
+ public List getJavaClassLoaders() {
+
+ return base.getJavaClassLoader();
+ }
+
+ @Override
+ public ImagePointer getJavaVM() throws CorruptDataException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public JavaVMInitArgs getJavaVMInitArgs() throws DataUnavailable,
+ CorruptDataException {
+ throw new DataUnavailable();
+ }
+
+ @Override
+ public List getMonitors() {
+
+ return base.getJavaMonitors();
+ }
+
+ @Override
+ public JavaObject getObjectAtAddress(ImagePointer arg0)
+ throws CorruptDataException, IllegalArgumentException,
+ MemoryAccessException, DataUnavailable {
+ CLogger.logr.log(Level.FINEST,"Ask for object at"+arg0.getAddress());
+ return base.getObjectAtAddress(arg0.getAddress());
+ }
+
+ @Override
+ public List getThreads() {
+
+ return base.getThreads();
+ }
+
+ @Override
+ public Object getTraceBuffer(String arg0, boolean arg1)
+ throws CorruptDataException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getFullVersion() throws CorruptDataException {
+
+ return "PYJVMTI 1.6.0";
+ }
+
+ @Override
+ public String getVersion() throws CorruptDataException {
+ return "1.6.0";
+ }
+
+}
Propchange: incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/JavaRuntimeImpl.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JClass.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JClass.java?rev=807673&view=auto
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JClass.java (added)
+++ incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JClass.java Tue Aug 25 15:41:23 2009
@@ -0,0 +1,183 @@
+/*******************************************************************************
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+package org.apache.kato.jvmti.javaruntime.model;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.tools.diagnostics.image.CorruptDataException;
+import javax.tools.diagnostics.image.ImagePointer;
+import javax.tools.diagnostics.runtime.java.JavaClass;
+import javax.tools.diagnostics.runtime.java.JavaClassLoader;
+import javax.tools.diagnostics.runtime.java.JavaObject;
+
+public class JClass implements JavaClass {
+ /**
+ *
+ */
+ private Model model = null;
+
+ /**
+ * @param binReader
+ */
+ JClass(Model model) {
+ this.model = model;
+ }
+
+ JClass() {
+
+ }
+
+ public long classid = 0;
+ public long superClassID;
+ public JClass superclass = null;
+ public long classloaderID;
+ public JClassLoader classloader = null;
+ public short status = 0;
+ public short modifiers = 0;
+ public short fieldCount = 0;
+ public short interfaceCount = 0;
+ public short methodsCount = 0;
+ public int nameLength = 0;
+ public String classSig = null;
+ public String sourceFile;
+ private List<JClass> interfaces = null;
+ private List<JMethod> methods = null;
+ private ObjectMapList<Long, JField> fields = null;
+ public int locIn; // remove this
+
+ @Override
+ public JavaClassLoader getClassLoader() throws CorruptDataException {
+ return classloader;
+ }
+
+ public void addInterface(JClass face) {
+ if (interfaces == null) {
+ interfaces = new LinkedList<JClass>();
+ }
+ interfaces.add(face);
+
+ }
+
+ public void addMethod(JMethod m) {
+ if (methods == null) {
+ methods = new LinkedList<JMethod>();
+ }
+ m.setParent(this);
+ methods.add(m);
+ }
+
+ @Override
+ public JavaClass getComponentType() throws CorruptDataException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public List getConstantPoolReferences() {
+ return new LinkedList();
+
+ }
+
+ @Override
+ public List getDeclaredFields() {
+
+ if (fields == null)
+ fields = new ObjectMapList<Long, JField>();
+ return fields.values();
+ }
+
+ @Override
+ public List getDeclaredMethods() {
+ if (methods == null)
+ methods = new LinkedList<JMethod>();
+ return methods;
+ }
+
+ @Override
+ public ImagePointer getID() {
+ // TODO Auto-generated method stub
+ return new SimpleImagePointer(classid);
+ }
+
+ @Override
+ public List getInterfaces() {
+ // TODO implement this
+ LinkedList<String> interfaceNames = new LinkedList<String>();
+ if (interfaces != null) {
+ for (JClass interfaceClass : interfaces) {
+ try {
+ interfaceNames.add(interfaceClass.getName());
+ } catch (CorruptDataException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+ return interfaceNames;
+ }
+
+ @Override
+ public int getModifiers() throws CorruptDataException {
+
+ return modifiers;
+ }
+
+ @Override
+ public String getName() throws CorruptDataException {
+ if (!isArray()) {
+ return classSig.substring(1, classSig.length() - 1);
+ }
+ return classSig;
+ }
+
+ @Override
+ public JavaObject getObject() throws CorruptDataException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public List getReferences() {
+ return new LinkedList();
+ }
+
+ @Override
+ public JavaClass getSuperclass() throws CorruptDataException {
+ return superclass;
+ }
+
+ @Override
+ public boolean isArray() throws CorruptDataException {
+ return classSig.startsWith("[");
+ }
+
+ public JField getField(long id) {
+
+ if (fields == null) {
+ fields = new ObjectMapList<Long, JField>();
+ }
+
+ JField f = fields.get(id);
+ if (f == null) {
+ f = new JField(this, id);
+ fields.put(id, f);
+ }
+ return f;
+
+ }
+
+}
+
Propchange: incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JClass.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JClassLoader.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JClassLoader.java?rev=807673&view=auto
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JClassLoader.java (added)
+++ incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JClassLoader.java Tue Aug 25 15:41:23 2009
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+package org.apache.kato.jvmti.javaruntime.model;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.tools.diagnostics.image.CorruptDataException;
+import javax.tools.diagnostics.runtime.java.JavaClass;
+import javax.tools.diagnostics.runtime.java.JavaClassLoader;
+import javax.tools.diagnostics.runtime.java.JavaObject;
+
+public class JClassLoader implements JavaClassLoader {
+
+ private List<JavaClass> classes=null;
+ public JObject obj = null;
+
+ @Override
+ public JavaClass findClass(String name) throws CorruptDataException {
+ for (JavaClass c: classes){
+ if (c.getName().equals(name))return c;
+ }
+ return null;
+ }
+
+ public void addClass(JClass c) {
+ if(classes==null) classes=new LinkedList<JavaClass>();
+ classes.add(c);
+ c.classloader = this;
+ }
+
+ @Override
+ public List getCachedClasses() {
+ return classes;
+ }
+
+ @Override
+ public List getDefinedClasses() {
+ if(classes==null) classes=new LinkedList<JavaClass>();
+ return classes;
+ }
+
+ @Override
+ public JavaObject getObject() throws CorruptDataException {
+ return obj;
+ }
+
+}
\ No newline at end of file
Propchange: incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JClassLoader.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JField.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JField.java?rev=807673&view=auto
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JField.java (added)
+++ incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JField.java Tue Aug 25 15:41:23 2009
@@ -0,0 +1,236 @@
+/*******************************************************************************
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+package org.apache.kato.jvmti.javaruntime.model;
+
+import java.util.logging.Level;
+
+import javax.tools.diagnostics.image.CorruptDataException;
+import javax.tools.diagnostics.image.DataUnavailable;
+import javax.tools.diagnostics.image.MemoryAccessException;
+import javax.tools.diagnostics.runtime.java.JavaClass;
+import javax.tools.diagnostics.runtime.java.JavaField;
+import javax.tools.diagnostics.runtime.java.JavaObject;
+
+import org.apache.kato.jvmti.reader.CLogger;
+
+public class JField implements JavaField, JValueHolder {
+
+ private JClass clazzid = null;
+ private long id = 0;
+
+ public String genericsignature;
+ public String signature;
+ public String name;
+ public boolean staticField = false;
+ public Object staticValue = null;
+ public int index = 0;
+ public int modifiers = 0;
+
+ public JField(JClass classid, long fid) {
+ this.clazzid = classid;
+ id = fid;
+
+ }
+
+ public long getFieldID() {
+ return id;
+ }
+
+ @Override
+ public Object get(JavaObject arg0) throws CorruptDataException,
+ MemoryAccessException {
+ if (staticValue != null) {
+ return staticValue;
+ }
+
+ CLogger.logr.log(Level.FINEST," " + this.name + " " + this.index + " "
+ + this.signature);
+ JObject job = (JObject) arg0;
+
+ return job.getValue(id);
+
+ }
+
+ @Override
+ public boolean getBoolean(JavaObject arg0) throws CorruptDataException,
+ MemoryAccessException {
+ if (staticValue != null) {
+ return (Boolean) staticValue;
+ }
+ JObject job = (JObject) arg0;
+ return job.getBooleanValue(id);
+ }
+
+ @Override
+ public byte getByte(JavaObject arg0) throws CorruptDataException,
+ MemoryAccessException {
+ if (staticValue != null) {
+ return (Byte) staticValue;
+ }
+ JObject job = (JObject) arg0;
+ return job.getByteValue(id);
+ }
+
+ @Override
+ public char getChar(JavaObject arg0) throws CorruptDataException,
+ MemoryAccessException {
+ if (staticValue != null) {
+ return (Character) staticValue;
+ }
+ JObject job = (JObject) arg0;
+ return job.getCharValue(id);
+ }
+
+ @Override
+ public double getDouble(JavaObject arg0) throws CorruptDataException,
+ MemoryAccessException {
+ if (staticValue != null) {
+ return (Double) staticValue;
+ }
+ JObject job = (JObject) arg0;
+ return job.getDoubleValue(id);
+ }
+
+ @Override
+ public float getFloat(JavaObject arg0) throws CorruptDataException,
+ MemoryAccessException {
+ if (staticValue != null) {
+ return (Float) staticValue;
+ }
+ JObject job = (JObject) arg0;
+ return job.getFloatValue(id);
+ }
+
+ @Override
+ public int getInt(JavaObject arg0) throws CorruptDataException,
+ MemoryAccessException {
+ if (staticValue != null) {
+ return (Integer) staticValue;
+ }
+ JObject job = (JObject) arg0;
+ return job.getIntValue(id);
+ }
+
+ @Override
+ public long getLong(JavaObject arg0) throws CorruptDataException,
+ MemoryAccessException {
+ if (staticValue != null) {
+ return (Long) staticValue;
+ }
+ JObject job = (JObject) arg0;
+ return job.getLongValue(id);
+ }
+
+ @Override
+ public short getShort(JavaObject arg0) throws CorruptDataException,
+ MemoryAccessException {
+ if (staticValue != null) {
+ return (Short) staticValue;
+ }
+ JObject job = (JObject) arg0;
+ return job.getShortValue(id);
+ }
+
+ @Override
+ public String getString(JavaObject arg0) throws CorruptDataException,
+ MemoryAccessException {
+ // Incorrect
+ if (staticValue != null) {
+ JObject stringObj = (JObject) staticValue;
+ JavaClass stringClass = stringObj.getJavaClass();
+ while (!stringClass.getName().equals("java/lang/String")) {
+ if ((stringClass = stringClass.getSuperclass()) == null) {
+ break;
+ }
+ }
+
+ if (stringClass != null) {
+ for (JavaField field : stringObj.getJavaClass()
+ .getDeclaredFields()) {
+ if (field.getSignature().equals("[C")) {
+ Character[] stringField = (Character[])((JObject)field.get(stringObj)).objArray;
+ char[] charArray = new char[stringField.length];
+ for (int i = 0; i < stringField.length; i++){
+ charArray[i] = stringField[i];
+ }
+ CLogger.logr.log(Level.FINEST,"From static field from "+field.getName()+" "+(new String(charArray)));
+ return new String(charArray);
+ }
+ }
+ }
+ }
+
+
+
+
+ if (arg0 != null) {
+ JObject obj = (JObject)arg0;
+ JavaObject stringObj = (JavaObject)obj.getValue(id);
+ JavaClass stringClass = stringObj.getJavaClass();
+ while (!stringClass.getName().equals("java/lang/String")) {
+ if ((stringClass = stringClass.getSuperclass()) == null) {
+ break;
+ }
+ }
+
+ if (stringClass != null) {
+ for (JavaField field : stringObj.getJavaClass()
+ .getDeclaredFields()) {
+ if (field.getSignature().equals("[C")) {
+ Character[] stringField = (Character[])((JObject)field.get(stringObj)).objArray;
+ char[] charArray = new char[stringField.length];
+ for (int i = 0; i < stringField.length; i++){
+ charArray[i] = stringField[i];
+ }
+ CLogger.logr.log(Level.FINEST,"From field "+field.getName()+" "+ (new String(charArray)));
+ return new String(charArray);
+ }
+ }
+ }
+ }
+ return "testTest";
+ }
+
+ @Override
+ public JavaClass getDeclaringClass() throws CorruptDataException,
+ DataUnavailable {
+
+ return clazzid;
+ }
+
+ @Override
+ public int getModifiers() throws CorruptDataException {
+ // TODO Auto-generated method stub
+ return modifiers;
+ }
+
+ @Override
+ public String getName() throws CorruptDataException {
+
+ return name;
+ }
+
+ @Override
+ public String getSignature() throws CorruptDataException {
+
+ return signature;
+ }
+
+ @Override
+ public void setValue(Object o) {
+ staticValue = o;
+ }
+
+}
\ No newline at end of file
Propchange: incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JField.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JFieldValue.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JFieldValue.java?rev=807673&view=auto
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JFieldValue.java (added)
+++ incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JFieldValue.java Tue Aug 25 15:41:23 2009
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+package org.apache.kato.jvmti.javaruntime.model;
+
+public class JFieldValue implements JValueHolder{
+
+ public int id=0;
+ public String signature;
+ public String name;
+ public Object value;
+ public JFieldValue(int id) {
+ this.id=id;
+ }
+ @Override
+ public void setValue(Object o) {
+ value=o;
+ }
+
+}
Propchange: incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JFieldValue.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JLocalVariable.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JLocalVariable.java?rev=807673&view=auto
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JLocalVariable.java (added)
+++ incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JLocalVariable.java Tue Aug 25 15:41:23 2009
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+package org.apache.kato.jvmti.javaruntime.model;
+
+import javax.tools.diagnostics.image.DataUnavailable;
+import javax.tools.diagnostics.runtime.java.JavaVariable;
+
+public class JLocalVariable implements JValueHolder,JavaVariable{
+
+ public Object value=null;
+ public int slot=0;
+ private JLocation location;
+
+
+ public JLocalVariable() {
+
+ }
+ @Override
+ public void setValue(Object o) {
+ value=o;
+
+ }
+
+ @Override
+ public int getLength() {
+ JLocalVariableTableEntry entry=location.method.getEntry(slot);
+ if(entry==null) return 0;
+ return entry.length;
+ }
+
+ @Override
+ public String getName() throws DataUnavailable {
+
+ JLocalVariableTableEntry entry=location.method.getEntry(slot);
+ if(entry==null) return null;
+ return entry.getName();
+ }
+
+ @Override
+ public String getSignature() {
+ JLocalVariableTableEntry entry=location.method.getEntry(slot);
+ if(entry==null) return null;
+ return entry.sig;
+ }
+
+ @Override
+ public int getSlot() {
+
+ return slot;
+ }
+
+ @Override
+ public int getStart() {
+ JLocalVariableTableEntry entry=location.method.getEntry(slot);
+ if(entry==null) return 0;
+ return entry.start;
+ }
+
+ @Override
+ public Object getValue() {
+ return value;
+ }
+ public void setLocation(JLocation loc) {
+ this.location=loc;
+
+ }
+
+}
Propchange: incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JLocalVariable.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JLocalVariableTableEntry.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JLocalVariableTableEntry.java?rev=807673&view=auto
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JLocalVariableTableEntry.java (added)
+++ incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JLocalVariableTableEntry.java Tue Aug 25 15:41:23 2009
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+package org.apache.kato.jvmti.javaruntime.model;
+
+import javax.tools.diagnostics.image.DataUnavailable;
+import javax.tools.diagnostics.runtime.java.JavaVariable;
+
+public class JLocalVariableTableEntry implements JavaVariable {
+
+ public String gensig;
+ public String sig;
+ private String name;
+ public int slot;
+ public int length;
+ public int start;
+
+
+ public int getLength() {
+ return length;
+ }
+
+ public void setName(String n) {
+ this.name=n;
+ }
+ public String getName() throws DataUnavailable {
+ if(name==null) return "slot:"+slot;
+ return name;
+ }
+
+ public String getSignature() {
+ return sig;
+ }
+
+ public int getSlot() {
+ return slot;
+ }
+
+ public int getStart() {
+ return start;
+ }
+
+
+
+ @Override
+ public Object getValue() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
\ No newline at end of file
Propchange: incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JLocalVariableTableEntry.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JLocation.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JLocation.java?rev=807673&view=auto
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JLocation.java (added)
+++ incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JLocation.java Tue Aug 25 15:41:23 2009
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+package org.apache.kato.jvmti.javaruntime.model;
+
+import javax.tools.diagnostics.image.CorruptDataException;
+import javax.tools.diagnostics.image.DataUnavailable;
+import javax.tools.diagnostics.image.ImagePointer;
+import javax.tools.diagnostics.runtime.java.JavaLocation;
+import javax.tools.diagnostics.runtime.java.JavaMethod;
+
+public class JLocation implements JavaLocation {
+
+
+ public JMethod method=null;
+ public String filename=null;
+ public int linenumber=0;
+ private ImagePointer p;
+ public JLocation() {
+
+ }
+ @Override
+ public ImagePointer getAddress() throws CorruptDataException {
+ // TODO Auto-generated method stub
+ return p;
+ }
+
+ public void setAddress(long addr){
+ p = new SimpleImagePointer(addr);
+ }
+
+ @Override
+ public int getCompilationLevel() throws CorruptDataException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public String getFilename() throws DataUnavailable,
+ CorruptDataException {
+
+ return filename;
+ }
+
+ @Override
+ public int getLineNumber() throws DataUnavailable, CorruptDataException {
+ return linenumber;
+ }
+
+ @Override
+ public JavaMethod getMethod() throws CorruptDataException {
+ return method;
+ }
+
+}
\ No newline at end of file
Propchange: incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JLocation.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JMethod.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JMethod.java?rev=807673&view=auto
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JMethod.java (added)
+++ incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JMethod.java Tue Aug 25 15:41:23 2009
@@ -0,0 +1,136 @@
+/*******************************************************************************
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+package org.apache.kato.jvmti.javaruntime.model;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Vector;
+import java.util.logging.Level;
+
+import javax.tools.diagnostics.image.CorruptDataException;
+import javax.tools.diagnostics.image.DataUnavailable;
+import javax.tools.diagnostics.runtime.java.JavaClass;
+import javax.tools.diagnostics.runtime.java.JavaMethod;
+
+import org.apache.kato.jvmti.reader.CLogger;
+
+public class JMethod implements JavaMethod {
+
+
+ public String genericsignature;
+ public int nativemethod;
+ public int argumentsize;
+ public int maxlocals;
+ public String name=null;
+ public String signature=null;
+ public int mods=0;
+ public JClass parent=null;
+ public HashMap<Long, Integer> lineNumberTable;
+ private ObjectMapList<Integer,JLocalVariableTableEntry> localVars=null;
+ public JMethod() {
+ }
+
+ public void setParent(JClass class1) {
+ parent=class1;
+ }
+
+ public void addLocalVariableTableEntry(JLocalVariableTableEntry entry) {
+ if(localVars==null) {
+ localVars=new ObjectMapList<Integer, JLocalVariableTableEntry>();
+ }
+
+ localVars.put(entry.slot,entry);
+ }
+
+ public void addLineNumberEntry(int lNum, long bytePos){
+ if (lineNumberTable == null){
+ lineNumberTable = new HashMap<Long, Integer>();
+ }
+ lineNumberTable.put(bytePos, lNum);
+ }
+
+ public int getLineNumber(long bytePos){
+ if(lineNumberTable == null){
+ return 0;
+ }
+ Vector<Long> v = new Vector<Long>(lineNumberTable.keySet());
+ Collections.sort(v);
+ Iterator<Long> it = v.iterator();
+ while(it.hasNext()){
+ long val = it.next();
+ CLogger.logr.log(Level.FINEST,"Value "+bytePos+" index "+val);
+ if(val>=bytePos){
+ return lineNumberTable.get(val);
+ }
+ }
+ return 0;
+ }
+
+
+ @Override
+ public List getBytecodeSections() {
+
+ return new LinkedList();
+ }
+
+ @Override
+ public List getCompiledSections() {
+ return new LinkedList();
+ }
+
+ @Override
+ public JavaClass getDeclaringClass() throws CorruptDataException,
+ DataUnavailable {
+
+ return parent;
+ }
+
+ @Override
+ public int getModifiers() throws CorruptDataException {
+
+ return mods;
+ }
+
+ @Override
+ public String getName() throws CorruptDataException {
+ return name;
+ }
+
+ @Override
+ public String getSignature() throws CorruptDataException {
+ return signature;
+ }
+
+ @Override
+ public List getVariables() {
+ if(localVars==null) {
+ localVars=new ObjectMapList<Integer, JLocalVariableTableEntry>();
+ }
+
+ return localVars.values();
+ }
+
+ public JLocalVariableTableEntry getEntry(int slot) {
+ if(localVars==null) {
+ localVars=new ObjectMapList<Integer, JLocalVariableTableEntry>();
+ }
+ return localVars.get(slot);
+
+ }
+
+}
\ No newline at end of file
Propchange: incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JMethod.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JMonitor.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JMonitor.java?rev=807673&view=auto
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JMonitor.java (added)
+++ incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JMonitor.java Tue Aug 25 15:41:23 2009
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+package org.apache.kato.jvmti.javaruntime.model;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.tools.diagnostics.image.CorruptDataException;
+import javax.tools.diagnostics.image.ImagePointer;
+import javax.tools.diagnostics.runtime.java.JavaMonitor;
+import javax.tools.diagnostics.runtime.java.JavaObject;
+import javax.tools.diagnostics.runtime.java.JavaThread;
+
+public class JMonitor implements JavaMonitor {
+ public static Model model;
+ private long owner=0;
+ public long monitorObject=0;
+ public long id=0;
+ List<Long> waiters=new LinkedList<Long>();
+
+ public JMonitor(long monitorid) {
+ this.id=monitorid;
+ }
+
+ @Override
+ public List getEnterWaiters() {
+ List<JavaThread> waitingThreads= new LinkedList<JavaThread>();
+ for (Long l: waiters){
+ waitingThreads.add(model.getThread(l));
+ }
+ return waitingThreads;
+ }
+
+ public void addWaiter(Long t) {
+ waiters.add(t);
+
+ }
+
+ @Override
+ public ImagePointer getID() {
+ // Possible issue
+ return new SimpleImagePointer(0);
+ }
+
+ @Override
+ public String getName() throws CorruptDataException {
+ // TODO Auto-generated method stub
+ return "Monitor "+id;
+ }
+
+ @Override
+ public List getNotifyWaiters() {
+ List<JavaThread> waitingThreads= new LinkedList<JavaThread>();
+ for (Long l: waiters){
+ waitingThreads.add(model.getThread(l));
+ }
+ return waitingThreads;
+ }
+
+ @Override
+ public JavaObject getObject() {
+ return model.getObjectAtAddress(monitorObject);
+ }
+
+ @Override
+ public JavaThread getOwner() throws CorruptDataException {
+ return model.getThread(owner);
+ }
+
+ public void setObject(long obj){
+ this.monitorObject = obj;
+ }
+
+ public void setOwner(long thread) {
+ this.owner=thread;
+
+ }
+
+}
\ No newline at end of file
Propchange: incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JMonitor.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JObject.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JObject.java?rev=807673&view=auto
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JObject.java (added)
+++ incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JObject.java Tue Aug 25 15:41:23 2009
@@ -0,0 +1,337 @@
+/*******************************************************************************
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+package org.apache.kato.jvmti.javaruntime.model;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+
+import org.apache.kato.jvmti.reader.CJVMTIBinReader;
+import org.apache.kato.jvmti.reader.CLogger;
+
+import javax.tools.diagnostics.image.CorruptDataException;
+import javax.tools.diagnostics.image.DataUnavailable;
+import javax.tools.diagnostics.image.ImagePointer;
+import javax.tools.diagnostics.image.MemoryAccessException;
+import javax.tools.diagnostics.runtime.java.JavaClass;
+import javax.tools.diagnostics.runtime.java.JavaHeap;
+import javax.tools.diagnostics.runtime.java.JavaObject;
+
+public class JObject implements JavaObject {
+
+ private long objid = 0;
+ private long size = 0;
+ private Map<Long, Object> data = new HashMap<Long, Object>();
+ private JClass clazz = null;
+ public boolean visited = false;
+ public boolean isArray = false;
+ public Object[] objArray;
+ public int objectSize = 0;
+ private JObject superClazzObject = null;
+
+ public JObject(JClass clazz, long objID) {
+ this.clazz = clazz;
+ this.objid = objID;
+ if (clazz != null) {
+ try {
+ this.isArray = clazz.isArray();
+ } catch (CorruptDataException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public void addValue(long fieldid, Object data) {
+ this.data.put(fieldid, data);
+ }
+
+ public double getDoubleValue(long id) {
+ Double d = (Double) data.get(id);
+ if (d == null && superClazzObject != null) {
+ return superClazzObject.getDoubleValue(id);
+ }
+ return d;
+ }
+
+ public long getLongValue(long id) {
+ Long d = (Long) data.get(id);
+ if (d == null && superClazzObject != null) {
+ return superClazzObject.getLongValue(id);
+ }
+ return d;
+ }
+
+ public char getCharValue(long id) {
+ Character d = (Character) data.get(id);
+ if (d == null && superClazzObject != null) {
+ return superClazzObject.getCharValue(id);
+ }
+ return d;
+
+ }
+
+ public boolean getBooleanValue(long id) {
+ Boolean d = (Boolean) data.get(id);
+ if (d == null && superClazzObject != null) {
+ return superClazzObject.getBooleanValue(id);
+ }
+ return d;
+ }
+
+ public byte getByteValue(long id) {
+ Byte d = (Byte) data.get(id);
+ if (d == null && superClazzObject != null) {
+ return superClazzObject.getByteValue(id);
+ }
+ return d;
+ }
+
+ public float getFloatValue(long id) {
+ Float d = (Float) data.get(id);
+ if (d == null && superClazzObject != null) {
+ return superClazzObject.getFloatValue(id);
+ }
+ return d;
+ }
+
+ public int getIntValue(long id) {
+ Integer d = (Integer) data.get(id);
+ if (d == null && superClazzObject != null) {
+ return superClazzObject.getIntValue(id);
+ }
+ return d;
+ }
+
+ public short getShortValue(long id) {
+ Short d = (Short) data.get(id);
+ if (d == null && superClazzObject != null) {
+ return superClazzObject.getShortValue(id);
+ }
+ return d;
+ }
+
+ public String getStringValue(long id) {
+ String d = (String) data.get(id);
+ if (d == null && superClazzObject != null) {
+ return superClazzObject.getStringValue(id);
+ }
+ return d;
+ }
+
+ public Object getValue(long id) {
+ if (data.containsKey(id)) {
+ return data.get(id);
+ } else {
+ if (superClazzObject != null) {
+ return superClazzObject.getValue(id);
+ } else {
+ System.out
+ .println("Missing field entry, this should not happen");
+ return null;
+ }
+ }
+ }
+
+ @Override
+ public void arraycopy(int srcStart, Object dst, int dstStart, int length)
+ throws CorruptDataException, MemoryAccessException {
+ // // TODO Implement array copy
+ // JClass intArray;// "[int"
+ // //
+ // JClass floatArray; // "[float"
+ // //
+ // JClass shortArray; // "[short"
+ // //
+ // JClass longArray; // "[long"
+ // //
+ // JClass byteArray; // "[byte"
+ // //
+ // JClass booleanArray; // "[boolean"
+ // //
+ // JClass doubleArray; // "[double"
+ // //
+ // JClass charArray; // "[char"
+
+ if (clazz.classSig.equals("[I")) {
+ CLogger.logr.log(Level.FINEST,"Array copy for int");
+ Integer[] ia = (Integer[]) objArray;
+ int index = 0;
+ int[] outArray = (int[]) dst;
+ for (int i = srcStart; i < srcStart + length; i++) {
+ outArray[index] = ia[i];
+ index++;
+ }
+ } else if (clazz.classSig.equals("[F")) {
+ CLogger.logr.log(Level.FINEST,"Array copy for float");
+ Float[] fa = (Float[]) objArray;
+ int index = 0;
+ float[] outArray = (float[]) dst;
+ for (int i = srcStart; i < srcStart + length; i++) {
+ outArray[index] = fa[i];
+ index++;
+ }
+ } else if (clazz.classSig.equals("[S")) {
+ CLogger.logr.log(Level.FINEST,"Array copy for short");
+ Short[] sa = (Short[]) objArray;
+ int index = 0;
+ short[] outArray = (short[]) dst;
+ for (int i = srcStart; i < srcStart + length; i++) {
+ outArray[index] = sa[i];
+ index++;
+ }
+ } else if (clazz.classSig.equals("[J")) {
+ CLogger.logr.log(Level.FINEST,"Array copy for long");
+ Long[] ja = (Long[]) objArray;
+ int index = 0;
+ long[] outArray = (long[]) dst;
+ for (int i = srcStart; i < srcStart + length; i++) {
+ outArray[index] = ja[i];
+ index++;
+ }
+ } else if (clazz.classSig.equals("[B")) {
+ CLogger.logr.log(Level.FINEST,"Array copy for byte");
+ Byte[] ba = (Byte[]) objArray;
+ int index = 0;
+ byte[] outArray = (byte[]) dst;
+ for (int i = srcStart; i < srcStart + length; i++) {
+ outArray[index] = ba[i];
+ index++;
+ }
+ } else if (clazz.classSig.equals("[Z")) {
+ CLogger.logr.log(Level.FINEST,"Array copy for boolean");
+ Boolean[] za = (Boolean[]) objArray;
+ int index = 0;
+ byte[] outArray = (byte[]) dst;
+ for (int i = srcStart; i < srcStart + length; i++) {
+ if (za[i]) {
+ outArray[index] = 1;
+ } else {
+ outArray[index] = 0;
+ }
+ index++;
+ }
+ } else if (clazz.classSig.equals("[D")) {
+ CLogger.logr.log(Level.FINEST,"Array copy for double");
+ Double[] da = (Double[]) objArray;
+ int index = 0;
+ double[] outArray = (double[]) dst;
+ for (int i = srcStart; i < srcStart + length; i++) {
+ outArray[index] = da[i];
+ index++;
+ }
+ } else if (clazz.classSig.equals("[C")) {
+ CLogger.logr.log(Level.FINEST,"Array copy for char");
+ Character[] ca = (Character[]) objArray;
+ int index = 0;
+ char[] outArray = (char[]) dst;
+ for (int i = srcStart; i < srcStart + length; i++) {
+ outArray[index] = ca[i];
+ index++;
+ }
+ } else {
+ CLogger.logr.log(Level.FINEST,"...Object array");
+ JObject[] ca = (JObject[]) objArray;
+ int index = 0;
+ JavaObject[] outArray = (JavaObject[]) dst;
+ for (int i = srcStart; i < srcStart + length; i++) {
+ outArray[index] = ca[i];
+ index++;
+ }
+ }
+ }
+
+ @Override
+ public int getArraySize() throws CorruptDataException {
+ return objArray.length;
+ }
+
+ @Override
+ public long getHashcode() throws DataUnavailable, CorruptDataException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public JavaHeap getHeap() throws CorruptDataException, DataUnavailable {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ImagePointer getID() {
+ return new SimpleImagePointer(objid);
+ }
+
+ @Override
+ public JavaClass getJavaClass() throws CorruptDataException {
+
+ CLogger.logr.log(Level.FINEST,"asking for class " + clazz);
+ return clazz;
+ }
+
+ @Override
+ public long getPersistentHashcode() throws DataUnavailable,
+ CorruptDataException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public List getReferences() {
+ return new LinkedList();
+ }
+
+ @Override
+ public List getSections() {
+
+ return new LinkedList();
+ }
+
+ @Override
+ public long getSize() throws CorruptDataException {
+
+ return size;
+ }
+
+ @Override
+ public boolean isArray() throws CorruptDataException {
+
+ return isArray;
+ }
+
+ public String toString() {
+ if (clazz == null) {
+ return "<unknown>@" + objid;
+ }
+ try {
+ return clazz.getName() + "@" + objid;
+ } catch (CorruptDataException e) {
+
+ return super.toString();
+ }
+ }
+
+ public void setSuperClazzObj(JObject supClazz) {
+ this.superClazzObject = supClazz;
+ }
+
+ public int getNumFields(){
+ return data.size();
+ }
+
+}
\ No newline at end of file
Propchange: incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JObject.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JStackFrame.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JStackFrame.java?rev=807673&view=auto
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JStackFrame.java (added)
+++ incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JStackFrame.java Tue Aug 25 15:41:23 2009
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+package org.apache.kato.jvmti.javaruntime.model;
+
+import java.util.LinkedList;
+import java.util.List;
+import java.util.logging.Level;
+
+import javax.tools.diagnostics.image.CorruptDataException;
+import javax.tools.diagnostics.image.DataUnavailable;
+import javax.tools.diagnostics.image.ImagePointer;
+import javax.tools.diagnostics.runtime.java.JavaLocation;
+import javax.tools.diagnostics.runtime.java.JavaStackFrame;
+import javax.tools.diagnostics.runtime.java.JavaVariable;
+
+import org.apache.kato.jvmti.reader.CLogger;
+
+public class JStackFrame implements JavaStackFrame {
+ private static int stackFrameIDCount = 1;
+ private JLocation location=null;
+ private int stackFrameID;
+ private ObjectMapList<Integer,JavaVariable> vars=new ObjectMapList<Integer, JavaVariable>();
+
+
+ public JStackFrame(){
+ stackFrameID = stackFrameIDCount;
+ stackFrameIDCount++;
+ }
+ @Override
+ public ImagePointer getBasePointer() throws CorruptDataException {
+
+ return new SimpleImagePointer(stackFrameID);
+ }
+
+ public void setLocation(JLocation loc) {
+ this.location=loc;
+ }
+ @Override
+ public List getHeapRoots() {
+ return new LinkedList();
+ }
+
+ @Override
+ public JavaLocation getLocation() throws CorruptDataException {
+
+ return location;
+ }
+
+ @Override
+ public Object getVariable(int slot) throws CorruptDataException,
+ DataUnavailable, IndexOutOfBoundsException {
+ Object r=vars.get(slot).getValue();
+ CLogger.logr.log(Level.FINEST,"asked for variable at slot "+slot+" ("+r+")");
+ return r;
+
+ }
+
+ public void addVariable(JLocalVariable value) {
+ value.setLocation(location);
+ vars.put(value.slot, value);
+ }
+
+ @Override
+ public List<JavaVariable> getVariables() {
+
+ return vars.values();
+ }
+
+ public void addVariable(int slot, Object data) {
+ JLocalVariable var=new JLocalVariable();
+ var.slot=slot;
+ var.value=data;
+ addVariable(var);
+
+ }
+}
\ No newline at end of file
Propchange: incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JStackFrame.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JThread.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JThread.java?rev=807673&view=auto
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JThread.java (added)
+++ incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JThread.java Tue Aug 25 15:41:23 2009
@@ -0,0 +1,166 @@
+/*******************************************************************************
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+package org.apache.kato.jvmti.javaruntime.model;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.tools.diagnostics.image.CorruptDataException;
+import javax.tools.diagnostics.image.DataUnavailable;
+import javax.tools.diagnostics.image.ImagePointer;
+import javax.tools.diagnostics.image.ImageThread;
+import javax.tools.diagnostics.image.MemoryAccessException;
+import javax.tools.diagnostics.runtime.java.JavaClass;
+import javax.tools.diagnostics.runtime.java.JavaHeap;
+import javax.tools.diagnostics.runtime.java.JavaObject;
+import javax.tools.diagnostics.runtime.java.JavaStackFrame;
+import javax.tools.diagnostics.runtime.java.JavaThread;
+
+public class JThread implements JavaThread{
+ public JMonitor contendedMonitor=null;
+ public long id=0;
+ public short priority=0;
+ public short daemon=0;
+ public int groupID=0;
+ public String threadName=null;
+
+
+ private List<JavaStackFrame> frames=new LinkedList<JavaStackFrame>();
+
+
+ public JThread(long id) {
+ this.id=id;
+ }
+
+ @Override
+ public ImageThread getImageThread() throws CorruptDataException,
+ DataUnavailable {
+
+ throw new DataUnavailable();
+ }
+
+
+ public void addStackFrame(JStackFrame frame) {
+ frames.add(frame);
+
+
+ }
+ @Override
+ public ImagePointer getJNIEnv() throws CorruptDataException {
+
+ return new SimpleImagePointer(id);
+ }
+ @Override
+ public String getName() throws CorruptDataException {
+
+ return threadName;
+ }
+ @Override
+ public JavaObject getObject() throws CorruptDataException {
+
+ return new JavaObject(){
+
+ @Override
+ public void arraycopy(int srcStart, Object dst, int dstStart,
+ int length) throws CorruptDataException,
+ MemoryAccessException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public int getArraySize() throws CorruptDataException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public long getHashcode() throws DataUnavailable,
+ CorruptDataException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public JavaHeap getHeap() throws CorruptDataException,
+ DataUnavailable {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ImagePointer getID() {
+ return new SimpleImagePointer(id);
+ }
+
+ @Override
+ public JavaClass getJavaClass() throws CorruptDataException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public long getPersistentHashcode() throws DataUnavailable,
+ CorruptDataException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public List getReferences() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public List getSections() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public long getSize() throws CorruptDataException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public boolean isArray() throws CorruptDataException {
+ // TODO Auto-generated method stub
+ return false;
+ }};
+
+
+ }
+ @Override
+ public int getPriority() throws CorruptDataException {
+
+ return priority;
+ }
+ @Override
+ public List getStackFrames() {
+ return frames;
+ }
+ @Override
+ public List getStackSections() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ @Override
+ public int getState() throws CorruptDataException {
+
+ return 0;
+ }
+}
\ No newline at end of file
Propchange: incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JThread.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JValueHolder.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JValueHolder.java?rev=807673&view=auto
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JValueHolder.java (added)
+++ incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JValueHolder.java Tue Aug 25 15:41:23 2009
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+package org.apache.kato.jvmti.javaruntime.model;
+
+public interface JValueHolder {
+
+ public void setValue(Object o);
+
+}
Propchange: incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JValueHolder.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/Model.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/Model.java?rev=807673&view=auto
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/Model.java (added)
+++ incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/Model.java Tue Aug 25 15:41:23 2009
@@ -0,0 +1,121 @@
+/*******************************************************************************
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+package org.apache.kato.jvmti.javaruntime.model;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.tools.diagnostics.runtime.java.JavaClass;
+import javax.tools.diagnostics.runtime.java.JavaClassLoader;
+import javax.tools.diagnostics.runtime.java.JavaMethod;
+import javax.tools.diagnostics.runtime.java.JavaMonitor;
+import javax.tools.diagnostics.runtime.java.JavaObject;
+import javax.tools.diagnostics.runtime.java.JavaThread;
+
+public class Model {
+
+ private ObjectMapList<Long,JavaThread> threadMap=new ObjectMapList<Long,JavaThread>();
+ Map<Long,JavaClass> classMap=new HashMap<Long,JavaClass>();
+ private ObjectMapList<Long,JavaClassLoader> loadersMap=new ObjectMapList<Long,JavaClassLoader>();
+ private ObjectMapList<Long,JavaMonitor> monitorsMap=new ObjectMapList<Long,JavaMonitor>();
+ private ObjectMapList<Long,JavaMethod> methodMap=new ObjectMapList<Long,JavaMethod>();
+ private ObjectMapList<Long,JavaObject> objectMap=new ObjectMapList<Long,JavaObject>();
+
+
+ public JClass getClass(long id) {
+ if(id==0) return null;
+ JClass m=(JClass) classMap.get(id);
+ if(m==null) {
+ m=new JClass(this);
+ m.classid=id;
+ classMap.put(id,m);
+ }
+ return m;
+ }
+
+
+
+ // TODO is this needed?
+ public JavaObject getObjectAtAddress(long loc){
+ return objectMap.get(loc);
+ }
+
+
+ public JMethod getMethod(long methodid) {
+ if(methodid==0) return null;
+ JMethod m=(JMethod) methodMap.get(methodid);
+ if(m==null) {
+ m=new JMethod();
+
+ methodMap.put(methodid,m);
+ }
+ return m;
+
+ }
+ public JClassLoader getLoader(long classloaderid) {
+
+ JClassLoader loader=(JClassLoader) loadersMap.get(classloaderid);
+ if(loader==null) {
+ loader=new JClassLoader();
+ loadersMap.put(classloaderid, loader);
+ }
+ return loader;
+ }
+
+
+public JObject getObject(long classid, long objectid) {
+
+ JObject o=(JObject) objectMap.get(objectid);
+ if(o==null) {
+
+ JClass clazz = null;
+
+ // TODO this is potentially wrong
+ if (classid !=0 ){
+ clazz=getClass(classid);}
+ o=new JObject(clazz,objectid);
+ objectMap.put(objectid,o);
+ }
+ return o;
+ }
+ public JMonitor getMonitor(long monitorid) {
+ if(monitorid==0) return null;
+ JMonitor m=(JMonitor) monitorsMap.get(monitorid);
+ if(m==null) {
+ m=new JMonitor(monitorid);
+ monitorsMap.put(monitorid,m);
+ }
+ return m;
+ }
+ public List getThreads() {
+ return threadMap.values();
+ }
+public List getJavaClassLoader() {
+
+ return loadersMap.values();
+ }
+ public List getJavaMonitors() {
+ return monitorsMap.values();
+ }
+ public JThread getThread(long id) {
+ JThread t=(JThread) threadMap.get(id);
+ if(t!=null) return t;
+ t=new JThread(id);
+ threadMap.put(t.id, t);
+ return t;
+ }
+
+}
Propchange: incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/Model.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/ObjectMapList.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/ObjectMapList.java?rev=807673&view=auto
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/ObjectMapList.java (added)
+++ incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/ObjectMapList.java Tue Aug 25 15:41:23 2009
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+package org.apache.kato.jvmti.javaruntime.model;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+
+public class ObjectMapList<K,V> {
+ HashMap<K,V> map=new HashMap<K,V>();
+ LinkedList<V> list=new LinkedList<V>();
+ public List<V> values() {
+
+ return list;
+ }
+ public V get(K key) {
+
+ return map.get(key);
+ }
+ public void put(K key, V value) {
+ if(map.containsKey(key)) {
+ Object orig=map.get(key);
+ list.remove(orig);
+ }
+ map.put(key, value);
+ list.add(value);
+ }
+}
\ No newline at end of file
Propchange: incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/ObjectMapList.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/SimpleImagePointer.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/SimpleImagePointer.java?rev=807673&view=auto
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/SimpleImagePointer.java (added)
+++ incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/SimpleImagePointer.java Tue Aug 25 15:41:23 2009
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+package org.apache.kato.jvmti.javaruntime.model;
+
+import javax.tools.diagnostics.image.CorruptDataException;
+import javax.tools.diagnostics.image.DataUnavailable;
+import javax.tools.diagnostics.image.ImageAddressSpace;
+import javax.tools.diagnostics.image.ImagePointer;
+import javax.tools.diagnostics.image.MemoryAccessException;
+
+public final class SimpleImagePointer implements ImagePointer {
+ private long address=0;
+ public SimpleImagePointer(long id) {
+ this.address=id;
+ }
+
+ @Override
+ public ImagePointer add(long offset) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public long getAddress() {
+
+ return address;
+ }
+
+ @Override
+ public ImageAddressSpace getAddressSpace() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public byte getByteAt(long index) throws MemoryAccessException,
+ CorruptDataException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public double getDoubleAt(long index)
+ throws MemoryAccessException, CorruptDataException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public float getFloatAt(long index)
+ throws MemoryAccessException, CorruptDataException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getIntAt(long index) throws MemoryAccessException,
+ CorruptDataException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public long getLongAt(long index) throws MemoryAccessException,
+ CorruptDataException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public ImagePointer getPointerAt(long index)
+ throws MemoryAccessException, CorruptDataException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public short getShortAt(long index)
+ throws MemoryAccessException, CorruptDataException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public boolean isExecutable() throws DataUnavailable {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isReadOnly() throws DataUnavailable {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isShared() throws DataUnavailable {
+ // TODO Auto-generated method stub
+ return false;
+ }
+}
\ No newline at end of file
Propchange: incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/SimpleImagePointer.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/process/ImageFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/process/ImageFactoryImpl.java?rev=807673&view=auto
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/process/ImageFactoryImpl.java (added)
+++ incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/process/ImageFactoryImpl.java Tue Aug 25 15:41:23 2009
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+package org.apache.kato.jvmti.process;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.tools.diagnostics.image.Image;
+import javax.tools.diagnostics.image.ImageFactory;
+
+public class ImageFactoryImpl implements ImageFactory{
+
+ private static String[] suffixes=new String[]{"cdmp"};
+
+ @Override
+ public Image getImage(File arg0) throws IOException {
+ return new ImageImpl(arg0);
+ }
+
+ @Override
+ public Image getImage(File arg0, File arg1) throws IOException {
+ return getImage(arg0);
+ }
+
+ @Override
+ public String[] getValidFileExtensions() {
+ return suffixes;
+ }
+
+ @Override
+ public int getMajorVersion() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getMinorVersion() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getModificationLevel() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+}
Propchange: incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/process/ImageFactoryImpl.java
------------------------------------------------------------------------------
svn:mime-type = text/plain