< prev index next >

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/LinuxDebuggerLocal.java

Print this page


   1 /*
   2  * Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 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 


   1 /*
   2  * Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 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     public native long findLibPtrByAddress0(long pc);
 125 
 126     @Override
 127     public Address findLibPtrByAddress(Address pc) {
 128       long ptr = findLibPtrByAddress0(pc.asLongValue());
 129       return (ptr == 0L) ? null
 130                          : new LinuxAddress(this, ptr);
 131     }
 132 
 133     // Note on Linux threads are really processes. When target process is
 134     // attached by a serviceability agent thread, only that thread can do
 135     // ptrace operations on the target. This is because from kernel's point
 136     // view, other threads are just separate processes and they are not
 137     // attached to the target. When they attempt to make ptrace calls,
 138     // an ESRCH error will be returned as kernel believes target is not
 139     // being traced by the caller.
 140     // To work around the problem, we use a worker thread here to handle
 141     // all JNI functions that are making ptrace calls.
 142 
 143     interface WorkerThreadTask {
 144        public void doit(LinuxDebuggerLocal debugger) throws DebuggerException;
 145     }
 146 
 147     class LinuxDebuggerLocalWorkerThread extends Thread {
 148        LinuxDebuggerLocal debugger;
 149        WorkerThreadTask task;
 150        DebuggerException lastException;
 151 


< prev index next >