104 private native void setSAAltRoot0(String altroot); 105 private native void attach0(int pid) 106 throws DebuggerException; 107 private native void attach0(String execName, String coreName) 108 throws DebuggerException; 109 private native void detach0() 110 throws DebuggerException; 111 private native long lookupByName0(String objectName, String symbol) 112 throws DebuggerException; 113 private native ClosestSymbol lookupByAddress0(long address) 114 throws DebuggerException; 115 private native long[] getThreadIntegerRegisterSet0(int lwp_id) 116 throws DebuggerException; 117 private native byte[] readBytesFromProcess0(long address, long numBytes) 118 throws DebuggerException; 119 public native static int getAddressSize() ; 120 121 @Override 122 public native String demangle(String sym); 123 124 // Note on Linux threads are really processes. When target process is 125 // attached by a serviceability agent thread, only that thread can do 126 // ptrace operations on the target. This is because from kernel's point 127 // view, other threads are just separate processes and they are not 128 // attached to the target. When they attempt to make ptrace calls, 129 // an ESRCH error will be returned as kernel believes target is not 130 // being traced by the caller. 131 // To work around the problem, we use a worker thread here to handle 132 // all JNI functions that are making ptrace calls. 133 134 interface WorkerThreadTask { 135 public void doit(LinuxDebuggerLocal debugger) throws DebuggerException; 136 } 137 138 class LinuxDebuggerLocalWorkerThread extends Thread { 139 LinuxDebuggerLocal debugger; 140 WorkerThreadTask task; 141 DebuggerException lastException; 142 143 public LinuxDebuggerLocalWorkerThread(LinuxDebuggerLocal debugger) { | 104 private native void setSAAltRoot0(String altroot); 105 private native void attach0(int pid) 106 throws DebuggerException; 107 private native void attach0(String execName, String coreName) 108 throws DebuggerException; 109 private native void detach0() 110 throws DebuggerException; 111 private native long lookupByName0(String objectName, String symbol) 112 throws DebuggerException; 113 private native ClosestSymbol lookupByAddress0(long address) 114 throws DebuggerException; 115 private native long[] getThreadIntegerRegisterSet0(int lwp_id) 116 throws DebuggerException; 117 private native byte[] readBytesFromProcess0(long address, long numBytes) 118 throws DebuggerException; 119 public native static int getAddressSize() ; 120 121 @Override 122 public native String demangle(String sym); 123 124 public native long findLibPtrByAddress0(long pc); 125 126 @Override 127 public long findLibPtrByAddress(Address pc) { 128 return findLibPtrByAddress0(pc.asLongValue()); 129 } 130 131 // Note on Linux threads are really processes. When target process is 132 // attached by a serviceability agent thread, only that thread can do 133 // ptrace operations on the target. This is because from kernel's point 134 // view, other threads are just separate processes and they are not 135 // attached to the target. When they attempt to make ptrace calls, 136 // an ESRCH error will be returned as kernel believes target is not 137 // being traced by the caller. 138 // To work around the problem, we use a worker thread here to handle 139 // all JNI functions that are making ptrace calls. 140 141 interface WorkerThreadTask { 142 public void doit(LinuxDebuggerLocal debugger) throws DebuggerException; 143 } 144 145 class LinuxDebuggerLocalWorkerThread extends Thread { 146 LinuxDebuggerLocal debugger; 147 WorkerThreadTask task; 148 DebuggerException lastException; 149 150 public LinuxDebuggerLocalWorkerThread(LinuxDebuggerLocal debugger) { |