246 } 247 return myvm; 248 } 249 250 251 VirtualMachineImpl(VirtualMachineManager mgr, int sequenceNumber) 252 throws Exception { 253 super(null); // Can't use super(this) 254 vm = this; 255 256 this.sequenceNumber = sequenceNumber; 257 this.vmmgr = mgr; 258 259 /* Create ThreadGroup to be used by all threads servicing 260 * this VM. 261 */ 262 threadGroupForJDI = new ThreadGroup("JDI [" + 263 this.hashCode() + "]"); 264 265 ((com.sun.tools.jdi.VirtualMachineManagerImpl)mgr).addVirtualMachine(this); 266 267 // By default SA agent classes prefer dbx debugger to proc debugger 268 // and Windows process debugger to windbg debugger. SA expects 269 // special properties to be set to choose other debuggers. We will set 270 // those here before attaching to SA agent. 271 272 System.setProperty("sun.jvm.hotspot.debugger.useProcDebugger", "true"); 273 System.setProperty("sun.jvm.hotspot.debugger.useWindbgDebugger", "true"); 274 } 275 276 // we reflectively use newly spec'ed class because our ALT_BOOTDIR 277 // is 1.4.2 and not 1.5. 278 private static Class vmCannotBeModifiedExceptionClass = null; 279 void throwNotReadOnlyException(String operation) { 280 RuntimeException re = null; 281 if (vmCannotBeModifiedExceptionClass == null) { 282 try { 283 vmCannotBeModifiedExceptionClass = Class.forName("com.sun.jdi.VMCannotBeModifiedException"); 284 } catch (ClassNotFoundException cnfe) { 285 vmCannotBeModifiedExceptionClass = UnsupportedOperationException.class; 286 } 287 } 288 try { 289 re = (RuntimeException) vmCannotBeModifiedExceptionClass.newInstance(); 290 } catch (Exception exp) { 291 re = new RuntimeException(exp.getMessage()); 292 } 293 throw re; | 246 } 247 return myvm; 248 } 249 250 251 VirtualMachineImpl(VirtualMachineManager mgr, int sequenceNumber) 252 throws Exception { 253 super(null); // Can't use super(this) 254 vm = this; 255 256 this.sequenceNumber = sequenceNumber; 257 this.vmmgr = mgr; 258 259 /* Create ThreadGroup to be used by all threads servicing 260 * this VM. 261 */ 262 threadGroupForJDI = new ThreadGroup("JDI [" + 263 this.hashCode() + "]"); 264 265 ((com.sun.tools.jdi.VirtualMachineManagerImpl)mgr).addVirtualMachine(this); 266 } 267 268 // we reflectively use newly spec'ed class because our ALT_BOOTDIR 269 // is 1.4.2 and not 1.5. 270 private static Class vmCannotBeModifiedExceptionClass = null; 271 void throwNotReadOnlyException(String operation) { 272 RuntimeException re = null; 273 if (vmCannotBeModifiedExceptionClass == null) { 274 try { 275 vmCannotBeModifiedExceptionClass = Class.forName("com.sun.jdi.VMCannotBeModifiedException"); 276 } catch (ClassNotFoundException cnfe) { 277 vmCannotBeModifiedExceptionClass = UnsupportedOperationException.class; 278 } 279 } 280 try { 281 re = (RuntimeException) vmCannotBeModifiedExceptionClass.newInstance(); 282 } catch (Exception exp) { 283 re = new RuntimeException(exp.getMessage()); 284 } 285 throw re; |