141 } else if (os.equals("darwin")) {
142 if (cpu.equals("amd64") || cpu.equals("x86_64")) {
143 access = new BsdAMD64JavaThreadPDAccess();
144 }
145 }
146
147 if (access == null) {
148 throw new RuntimeException("OS/CPU combination " + os + "/" + cpu +
149 " not yet supported");
150 }
151
152 virtualConstructor = new VirtualConstructor(db);
153 // Add mappings for all known thread types
154 virtualConstructor.addMapping("JavaThread", JavaThread.class);
155 if (!VM.getVM().isCore()) {
156 virtualConstructor.addMapping("CompilerThread", CompilerThread.class);
157 virtualConstructor.addMapping("CodeCacheSweeperThread", CodeCacheSweeperThread.class);
158 }
159 virtualConstructor.addMapping("JvmtiAgentThread", JvmtiAgentThread.class);
160 virtualConstructor.addMapping("ServiceThread", ServiceThread.class);
161 }
162
163 public Threads() {
164 _list = VMObjectFactory.newObject(ThreadsList.class, threadListField.getValue());
165 }
166
167 /** NOTE: this returns objects of type JavaThread, CompilerThread,
168 JvmtiAgentThread, and ServiceThread.
169 The latter four are subclasses of the former. Most operations
170 (fetching the top frame, etc.) are only allowed to be performed on
171 a "pure" JavaThread. For this reason, {@link
172 sun.jvm.hotspot.runtime.JavaThread#isJavaThread} has been
173 changed from the definition in the VM (which returns true for
174 all of these thread types) to return true for JavaThreads and
175 false for the three subclasses. FIXME: should reconsider the
176 inheritance hierarchy; see {@link
177 sun.jvm.hotspot.runtime.JavaThread#isJavaThread}. */
178 public JavaThread getJavaThreadAt(int i) {
179 if (i < _list.length()) {
180 return createJavaThreadWrapper(_list.getJavaThreadAddressAt(i));
181 }
182 return null;
183 }
184
185 public int getNumberOfThreads() {
186 return (int) _list.length();
187 }
188
|
141 } else if (os.equals("darwin")) {
142 if (cpu.equals("amd64") || cpu.equals("x86_64")) {
143 access = new BsdAMD64JavaThreadPDAccess();
144 }
145 }
146
147 if (access == null) {
148 throw new RuntimeException("OS/CPU combination " + os + "/" + cpu +
149 " not yet supported");
150 }
151
152 virtualConstructor = new VirtualConstructor(db);
153 // Add mappings for all known thread types
154 virtualConstructor.addMapping("JavaThread", JavaThread.class);
155 if (!VM.getVM().isCore()) {
156 virtualConstructor.addMapping("CompilerThread", CompilerThread.class);
157 virtualConstructor.addMapping("CodeCacheSweeperThread", CodeCacheSweeperThread.class);
158 }
159 virtualConstructor.addMapping("JvmtiAgentThread", JvmtiAgentThread.class);
160 virtualConstructor.addMapping("ServiceThread", ServiceThread.class);
161 virtualConstructor.addMapping("NotificationThread", NotificationThread.class);
162 }
163
164 public Threads() {
165 _list = VMObjectFactory.newObject(ThreadsList.class, threadListField.getValue());
166 }
167
168 /** NOTE: this returns objects of type JavaThread, CompilerThread,
169 JvmtiAgentThread, NotificationThread, and ServiceThread.
170 The latter four are subclasses of the former. Most operations
171 (fetching the top frame, etc.) are only allowed to be performed on
172 a "pure" JavaThread. For this reason, {@link
173 sun.jvm.hotspot.runtime.JavaThread#isJavaThread} has been
174 changed from the definition in the VM (which returns true for
175 all of these thread types) to return true for JavaThreads and
176 false for the three subclasses. FIXME: should reconsider the
177 inheritance hierarchy; see {@link
178 sun.jvm.hotspot.runtime.JavaThread#isJavaThread}. */
179 public JavaThread getJavaThreadAt(int i) {
180 if (i < _list.length()) {
181 return createJavaThreadWrapper(_list.getJavaThreadAddressAt(i));
182 }
183 return null;
184 }
185
186 public int getNumberOfThreads() {
187 return (int) _list.length();
188 }
189
|