sun.jvm.hotspot.debugger.DebuggerException Java Examples

The following examples show how to use sun.jvm.hotspot.debugger.DebuggerException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BsdDebuggerLocal.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public WorkerThreadTask execute(WorkerThreadTask task) throws DebuggerException {
   synchronized (workerThread) {
      this.task = task;
      workerThread.notifyAll();
      while (this.task != null) {
         try {
            workerThread.wait();
         } catch (InterruptedException x) {}
      }
      if (lastException != null) {
         throw new DebuggerException(lastException);
      } else {
         return task;
      }
   }
}
 
Example #2
Source File: LinuxDebuggerLocal.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public void run() {
   synchronized (workerThread) {
      for (;;) {
         if (task != null) {
            lastException = null;
            try {
               task.doit(debugger);
            } catch (DebuggerException exp) {
               lastException = exp;
            }
            task = null;
            workerThread.notifyAll();
         }

         try {
            workerThread.wait();
         } catch (InterruptedException x) {}
      }
   }
}
 
Example #3
Source File: LinuxDebuggerLocal.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public WorkerThreadTask execute(WorkerThreadTask task) throws DebuggerException {
   synchronized (workerThread) {
      this.task = task;
      workerThread.notifyAll();
      while (this.task != null) {
         try {
            workerThread.wait();
         } catch (InterruptedException x) {}
      }
      if (lastException != null) {
         throw new DebuggerException(lastException);
      } else {
         return task;
      }
   }
}
 
Example #4
Source File: LinuxDebuggerLocal.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public void run() {
   synchronized (workerThread) {
      for (;;) {
         if (task != null) {
            lastException = null;
            try {
               task.doit(debugger);
            } catch (DebuggerException exp) {
               lastException = exp;
            }
            task = null;
            workerThread.notifyAll();
         }

         try {
            workerThread.wait();
         } catch (InterruptedException x) {}
      }
   }
}
 
Example #5
Source File: BsdDebuggerLocal.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public synchronized long[] getThreadIntegerRegisterSet(long unique_thread_id)
                                        throws DebuggerException {
    requireAttach();
    if (isCore) {
        return getThreadIntegerRegisterSet0(unique_thread_id);
    } else {
        class GetThreadIntegerRegisterSetTask implements WorkerThreadTask {
            long unique_thread_id;
            long[] result;
            public void doit(BsdDebuggerLocal debugger) {
                result = debugger.getThreadIntegerRegisterSet0(unique_thread_id);
            }
        }

        GetThreadIntegerRegisterSetTask task = new GetThreadIntegerRegisterSetTask();
        task.unique_thread_id = unique_thread_id;
        workerThread.execute(task);
        return task.result;
    }
}
 
Example #6
Source File: LinuxDebuggerLocal.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public WorkerThreadTask execute(WorkerThreadTask task) throws DebuggerException {
   synchronized (workerThread) {
      this.task = task;
      workerThread.notifyAll();
      while (this.task != null) {
         try {
            workerThread.wait();
         } catch (InterruptedException x) {}
      }
      if (lastException != null) {
         throw new DebuggerException(lastException);
      } else {
         return task;
      }
   }
}
 
Example #7
Source File: BsdDebuggerLocal.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public void run() {
   synchronized (workerThread) {
      for (;;) {
         if (task != null) {
            lastException = null;
            try {
               task.doit(debugger);
            } catch (DebuggerException exp) {
               lastException = exp;
            }
            task = null;
            workerThread.notifyAll();
         }

         try {
            workerThread.wait();
         } catch (InterruptedException x) {}
      }
   }
}
 
Example #8
Source File: LinuxDebuggerLocal.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/** From the Debugger interface via JVMDebugger */
public synchronized void attach(int processID) throws DebuggerException {
    checkAttached();
    threadList = new ArrayList();
    loadObjectList = new ArrayList();
    class AttachTask implements WorkerThreadTask {
       int pid;
       public void doit(LinuxDebuggerLocal debugger) {
          debugger.attach0(pid);
          debugger.attached = true;
          debugger.isCore = false;
          findABIVersion();
       }
    }

    AttachTask task = new AttachTask();
    task.pid = processID;
    workerThread.execute(task);
}
 
Example #9
Source File: LinuxDebuggerLocal.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public void run() {
   synchronized (workerThread) {
      for (;;) {
         if (task != null) {
            lastException = null;
            try {
               task.doit(debugger);
            } catch (DebuggerException exp) {
               lastException = exp;
            }
            task = null;
            workerThread.notifyAll();
         }

         try {
            workerThread.wait();
         } catch (InterruptedException x) {}
      }
   }
}
 
Example #10
Source File: BsdDebuggerLocal.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public void run() {
   synchronized (workerThread) {
      for (;;) {
         if (task != null) {
            lastException = null;
            try {
               task.doit(debugger);
            } catch (DebuggerException exp) {
               lastException = exp;
            }
            task = null;
            workerThread.notifyAll();
         }

         try {
            workerThread.wait();
         } catch (InterruptedException x) {}
      }
   }
}
 
Example #11
Source File: LinuxDebuggerLocal.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public synchronized long[] getThreadIntegerRegisterSet(int lwp_id)
                                        throws DebuggerException {
    requireAttach();
    if (isCore) {
        return getThreadIntegerRegisterSet0(lwp_id);
    } else {
        class GetThreadIntegerRegisterSetTask implements WorkerThreadTask {
            int lwp_id;
            long[] result;
            public void doit(LinuxDebuggerLocal debugger) {
                result = debugger.getThreadIntegerRegisterSet0(lwp_id);
            }
        }

        GetThreadIntegerRegisterSetTask task = new GetThreadIntegerRegisterSetTask();
        task.lwp_id = lwp_id;
        workerThread.execute(task);
        return task.result;
    }
}
 
Example #12
Source File: BsdDebuggerLocal.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/** From the Debugger interface via JVMDebugger */
public synchronized void attach(int processID) throws DebuggerException {
    checkAttached();
    threadList = new ArrayList();
    loadObjectList = new ArrayList();
    class AttachTask implements WorkerThreadTask {
       int pid;
       public void doit(BsdDebuggerLocal debugger) {
          debugger.attach0(pid);
          debugger.attached = true;
          debugger.isCore = false;
          findABIVersion();
       }
    }

    AttachTask task = new AttachTask();
    task.pid = processID;
    workerThread.execute(task);
}
 
Example #13
Source File: RMIHelper.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public static Remote lookup(String debugServerID) throws DebuggerException {
    // debugServerID follows the pattern [unique_id@]host[:port]
    // we have to transform this as //host[:port]/<serverNamePrefix>['_'<unique_id>]

    int index = debugServerID.indexOf('@');
    StringBuffer nameBuf = new StringBuffer("//");
    String uniqueID = null;
    if (index != -1) {
        nameBuf.append(debugServerID.substring(index + 1));
        uniqueID = debugServerID.substring(0, index);
    } else {
        nameBuf.append(debugServerID);
    }

    nameBuf.append('/');
    nameBuf.append(serverNamePrefix);
    if (uniqueID != null) {
        nameBuf.append('_');
        nameBuf.append(uniqueID);
    }

    try {
        return Naming.lookup(nameBuf.toString());
    } catch (Exception exp) {
        throw new DebuggerException(exp);
    }
}
 
Example #14
Source File: LinuxDebuggerLocal.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private void findABIVersion() throws DebuggerException {
    if (lookupByName0("libjvm.so", "__vt_10JavaThread") != 0) {
        // old C++ ABI
        useGCC32ABI = false;
    } else {
        // new C++ ABI
        useGCC32ABI = true;
    }
}
 
Example #15
Source File: BsdDebuggerLocal.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private long handleGCC32ABI(long addr, String symbol) throws DebuggerException {
    if (useGCC32ABI && symbol.startsWith("_ZTV")) {
        return addr + (2 * machDesc.getAddressSize());
    } else {
        return addr;
    }
}
 
Example #16
Source File: BsdDebuggerLocal.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private long handleGCC32ABI(long addr, String symbol) throws DebuggerException {
    if (useGCC32ABI && symbol.startsWith("_ZTV")) {
        return addr + (2 * machDesc.getAddressSize());
    } else {
        return addr;
    }
}
 
Example #17
Source File: BsdDebuggerLocal.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private void checkAttached() throws DebuggerException {
    if (attached) {
        if (isCore) {
            throw new DebuggerException("attached to a core dump already");
        } else {
            throw new DebuggerException("attached to a process already");
        }
    }
}
 
Example #18
Source File: HotSpotAgent.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/** This opens a core file on the local machine */
public synchronized void attach(String javaExecutableName, String coreFileName)
throws DebuggerException {
    if (debugger != null) {
        throw new DebuggerException("Already attached");
    }
    if ((javaExecutableName == null) || (coreFileName == null)) {
        throw new DebuggerException("Both the core file name and Java executable name must be specified");
    }
    this.javaExecutableName = javaExecutableName;
    this.coreFileName = coreFileName;
    startupMode = CORE_FILE_MODE;
    isServer = false;
    go();
}
 
Example #19
Source File: HotSpotAgent.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private void setupDebuggerDarwin() {
    setupJVMLibNamesDarwin();

    if (cpu.equals("amd64") || cpu.equals("x86_64")) {
        machDesc = new MachineDescriptionAMD64();
    } else {
        throw new DebuggerException("Darwin only supported on x86_64. Current arch: " + cpu);
    }

    BsdDebuggerLocal dbg = new BsdDebuggerLocal(machDesc, !isServer);
    debugger = dbg;

    attachDebugger();
}
 
Example #20
Source File: HotSpotAgent.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private void connectRemoteDebugger() throws DebuggerException {
    RemoteDebugger remote =
    (RemoteDebugger) RMIHelper.lookup(debugServerID);
    debugger = new RemoteDebuggerClient(remote);
    machDesc = ((RemoteDebuggerClient) debugger).getMachineDescription();
    os = debugger.getOS();
    setupJVMLibNames(os);
    cpu = debugger.getCPU();
}
 
Example #21
Source File: LinuxDebuggerLocal.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private void checkAttached() throws DebuggerException {
    if (attached) {
        if (isCore) {
            throw new DebuggerException("attached to a core dump already");
        } else {
            throw new DebuggerException("attached to a process already");
        }
    }
}
 
Example #22
Source File: HotSpotAgent.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/** This opens a core file on the local machine */
public synchronized void attach(String javaExecutableName, String coreFileName)
throws DebuggerException {
    if (debugger != null) {
        throw new DebuggerException("Already attached");
    }
    if ((javaExecutableName == null) || (coreFileName == null)) {
        throw new DebuggerException("Both the core file name and Java executable name must be specified");
    }
    this.javaExecutableName = javaExecutableName;
    this.coreFileName = coreFileName;
    startupMode = CORE_FILE_MODE;
    isServer = false;
    go();
}
 
Example #23
Source File: RMIHelper.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public static Remote lookup(String debugServerID) throws DebuggerException {
    // debugServerID follows the pattern [unique_id@]host[:port]
    // we have to transform this as //host[:port]/<serverNamePrefix>['_'<unique_id>]

    int index = debugServerID.indexOf('@');
    StringBuffer nameBuf = new StringBuffer("//");
    String uniqueID = null;
    if (index != -1) {
        nameBuf.append(debugServerID.substring(index + 1));
        uniqueID = debugServerID.substring(0, index);
    } else {
        nameBuf.append(debugServerID);
    }

    nameBuf.append('/');
    nameBuf.append(serverNamePrefix);
    if (uniqueID != null) {
        nameBuf.append('_');
        nameBuf.append(uniqueID);
    }

    try {
        return Naming.lookup(nameBuf.toString());
    } catch (Exception exp) {
        throw new DebuggerException(exp);
    }
}
 
Example #24
Source File: HotSpotAgent.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private boolean detachInternal() {
    if (debugger == null) {
        return false;
    }
    boolean retval = true;
    if (!isServer) {
        VM.shutdown();
    }
    // We must not call detach() if we are a client and are connected
    // to a remote debugger
    Debugger dbg = null;
    DebuggerException ex = null;
    if (isServer) {
        try {
            RMIHelper.unbind(serverID);
        }
        catch (DebuggerException de) {
            ex = de;
        }
        dbg = debugger;
    } else {
        if (startupMode != REMOTE_MODE) {
            dbg = debugger;
        }
    }
    if (dbg != null) {
        retval = dbg.detach();
    }

    debugger = null;
    machDesc = null;
    db = null;
    if (ex != null) {
        throw(ex);
    }
    return retval;
}
 
Example #25
Source File: HotSpotAgent.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/** This should only be called by the user on the client machine,
  not the server machine */
public synchronized boolean detach() throws DebuggerException {
    if (isServer) {
        throw new DebuggerException("Should not call detach() for server configuration");
    }
    return detachInternal();
}
 
Example #26
Source File: HotSpotAgent.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private void connectRemoteDebugger() throws DebuggerException {
    RemoteDebugger remote =
    (RemoteDebugger) RMIHelper.lookup(debugServerID);
    debugger = new RemoteDebuggerClient(remote);
    machDesc = ((RemoteDebuggerClient) debugger).getMachineDescription();
    os = debugger.getOS();
    setupJVMLibNames(os);
    cpu = debugger.getCPU();
}
 
Example #27
Source File: LinuxDebuggerLocal.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private long handleGCC32ABI(long addr, String symbol) throws DebuggerException {
    if (useGCC32ABI && symbol.startsWith("_ZTV")) {
        return addr + (2 * machDesc.getAddressSize());
    } else {
        return addr;
    }
}
 
Example #28
Source File: HotSpotAgent.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/** This should only be called by the user on the client machine,
  not the server machine */
public synchronized boolean detach() throws DebuggerException {
    if (isServer) {
        throw new DebuggerException("Should not call detach() for server configuration");
    }
    return detachInternal();
}
 
Example #29
Source File: HotSpotAgent.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/** This attaches to a process running on the local machine. */
public synchronized void attach(int processID)
throws DebuggerException {
    if (debugger != null) {
        throw new DebuggerException("Already attached");
    }
    pid = processID;
    startupMode = PROCESS_MODE;
    isServer = false;
    go();
}
 
Example #30
Source File: BsdDebuggerLocal.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private long handleGCC32ABI(long addr, String symbol) throws DebuggerException {
    if (useGCC32ABI && symbol.startsWith("_ZTV")) {
        return addr + (2 * machDesc.getAddressSize());
    } else {
        return addr;
    }
}