comparison agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdDebuggerLocal.java @ 8023:758935f7c23f

8006423: SA: NullPointerException in sun.jvm.hotspot.debugger.bsd.BsdThread.getContext(BsdThread.java:67) Summary: Do not rely on mach thread port names to identify threads from SA Reviewed-by: dholmes, minqi, rbackman
author sla
date Fri, 08 Feb 2013 12:48:24 +0100
parents 8e47bac5643a
children 39432a1cefdd
comparison
equal deleted inserted replaced
8021:8d9fc28831cc 8023:758935f7c23f
88 throws DebuggerException; 88 throws DebuggerException;
89 private native long lookupByName0(String objectName, String symbol) 89 private native long lookupByName0(String objectName, String symbol)
90 throws DebuggerException; 90 throws DebuggerException;
91 private native ClosestSymbol lookupByAddress0(long address) 91 private native ClosestSymbol lookupByAddress0(long address)
92 throws DebuggerException; 92 throws DebuggerException;
93 private native long[] getThreadIntegerRegisterSet0(int lwp_id) 93 private native long[] getThreadIntegerRegisterSet0(long unique_thread_id)
94 throws DebuggerException; 94 throws DebuggerException;
95 private native byte[] readBytesFromProcess0(long address, long numBytes) 95 private native byte[] readBytesFromProcess0(long address, long numBytes)
96 throws DebuggerException; 96 throws DebuggerException;
97 public native static int getAddressSize() ; 97 public native static int getAddressSize() ;
98 98
398 //---------------------------------------------------------------------- 398 //----------------------------------------------------------------------
399 // Implementation of ThreadAccess interface 399 // Implementation of ThreadAccess interface
400 // 400 //
401 401
402 /** From the ThreadAccess interface via Debugger and JVMDebugger */ 402 /** From the ThreadAccess interface via Debugger and JVMDebugger */
403 public ThreadProxy getThreadForIdentifierAddress(Address threadIdAddr, Address uniqueThreadIdAddr) {
404 return new BsdThread(this, threadIdAddr, uniqueThreadIdAddr);
405 }
406 @Override
403 public ThreadProxy getThreadForIdentifierAddress(Address addr) { 407 public ThreadProxy getThreadForIdentifierAddress(Address addr) {
404 return new BsdThread(this, addr); 408 throw new RuntimeException("unimplemented");
405 } 409 }
410
406 411
407 /** From the ThreadAccess interface via Debugger and JVMDebugger */ 412 /** From the ThreadAccess interface via Debugger and JVMDebugger */
408 public ThreadProxy getThreadForThreadId(long id) { 413 public ThreadProxy getThreadForThreadId(long id) {
409 return new BsdThread(this, id); 414 return new BsdThread(this, id);
410 } 415 }
453 458
454 //---------------------------------------------------------------------- 459 //----------------------------------------------------------------------
455 // Thread context access 460 // Thread context access
456 // 461 //
457 462
458 public synchronized long[] getThreadIntegerRegisterSet(int lwp_id) 463 public synchronized long[] getThreadIntegerRegisterSet(long unique_thread_id)
459 throws DebuggerException { 464 throws DebuggerException {
460 requireAttach(); 465 requireAttach();
461 if (isCore) { 466 if (isCore) {
462 return getThreadIntegerRegisterSet0(lwp_id); 467 return getThreadIntegerRegisterSet0(unique_thread_id);
463 } else { 468 } else {
464 class GetThreadIntegerRegisterSetTask implements WorkerThreadTask { 469 class GetThreadIntegerRegisterSetTask implements WorkerThreadTask {
465 int lwp_id; 470 long unique_thread_id;
466 long[] result; 471 long[] result;
467 public void doit(BsdDebuggerLocal debugger) { 472 public void doit(BsdDebuggerLocal debugger) {
468 result = debugger.getThreadIntegerRegisterSet0(lwp_id); 473 result = debugger.getThreadIntegerRegisterSet0(unique_thread_id);
469 } 474 }
470 } 475 }
471 476
472 GetThreadIntegerRegisterSetTask task = new GetThreadIntegerRegisterSetTask(); 477 GetThreadIntegerRegisterSetTask task = new GetThreadIntegerRegisterSetTask();
473 task.lwp_id = lwp_id; 478 task.unique_thread_id = unique_thread_id;
474 workerThread.execute(task); 479 workerThread.execute(task);
475 return task.result; 480 return task.result;
476 } 481 }
477 } 482 }
478 483