101 102 private native static void init0() 103 throws DebuggerException; 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 // Note on Linux threads are really processes. When target process is 122 // attached by a serviceability agent thread, only that thread can do 123 // ptrace operations on the target. This is because from kernel's point 124 // view, other threads are just separate processes and they are not 125 // attached to the target. When they attempt to make ptrace calls, 126 // an ESRCH error will be returned as kernel believes target is not 127 // being traced by the caller. 128 // To work around the problem, we use a worker thread here to handle 129 // all JNI functions that are making ptrace calls. 130 131 interface WorkerThreadTask { 132 public void doit(LinuxDebuggerLocal debugger) throws DebuggerException; 133 } 134 135 class LinuxDebuggerLocalWorkerThread extends Thread { 136 LinuxDebuggerLocal debugger; 137 WorkerThreadTask task; 138 DebuggerException lastException; 139 140 public LinuxDebuggerLocalWorkerThread(LinuxDebuggerLocal debugger) { | 101 102 private native static void init0() 103 throws DebuggerException; 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) { |