Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8263005

Add SA Command Line Debugger support to connect to debug server

    XMLWordPrintable

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P4
    • Resolution: Approved
    • Fix Version/s: 17
    • Component/s: hotspot
    • Labels:
      None
    • Subcomponent:
    • Compatibility Kind:
      behavioral
    • Compatibility Risk:
      low
    • Compatibility Risk Description:
      It changes the behavior when non-numerical string is passed to `attach` in command line debugger. But the document (clhsdb.html) just says it will be handled as PID when just 1 argument is passed to `attach`. So the risk is low.
    • Interface Kind:
      Other
    • Scope:
      JDK

      Description

      Summary

      Add feature for connecting to an SA debug server from the Command Line Debugger.

      Problem

      The Command Line Debugger is a command line interface to the SA debugging support. It can be started via jhsdb clhsdb or by using the "Windows" -> "Console" menu option when running SA GUI tool, which is started with jhsdb hsdb.

      Before debugging you first need to attach to the hotspot debuggee. The Command Line Debugger supports specifying attach arguments on the jhsdb clhsdb command line, or by using the attach command once in the Command Line Debugger. This CSR only concerns the attach command. SA supports 3 different types of debuggees to attach to:

      1. Live process
      2. Core file
      3. Debug server (a proxy for a jvm process running on remote machine)

      Most of jhsdb sub commands (jstack, jmap, etc...) support all 3, but the Command Line Debugger does not support connecting to a debug server. The attach command only accepts a PID argument a core file argument.

      Solution

      Add support to the Command Line Debugger attach command for connecting to a debug server. However, there is a need to differentiate between the 3 debuggee types, since the attach command does not support explicitly stating the type of debuggee being attached to. The debuggee type is implied by parsing the argument(s). Currently if there is one argument it is assumed to be a PID. If there are two arguments they are assumed to be the path to the executable and the path to the core file. For attaching to a debug server, there will be one argument (the name of the debug server).

      In order to differentiate between a debug server name argument and a PID argument, it will be assumed that if the argument is numeric, it is is PID. Otherwise it is assumed to be a debug server name. Previously a single non-numeric argument would have produced the error message "Unable to parse process ID". Now instead it will be used as the debug server name to connect to.

      Specification

      diff --git a/src/jdk.hotspot.agent/doc/clhsdb.html b/src/jdk.hotspot.agent/doc/clhsdb.html
      index 94b494f6cc0..a920706467c 100644
      --- a/src/jdk.hotspot.agent/doc/clhsdb.html
      +++ b/src/jdk.hotspot.agent/doc/clhsdb.html
      @@ -36,7 +36,7 @@ Each CLHSDB command can have zero or more arguments and optionally end with outp
       <code>
       Available commands:
         assert true | false <font color="red">turn on/off asserts in SA code</font>
      -  attach pid | exec core  <font color="red">attach SA to a process or core</font>
      +  attach pid | exec core | debugserver  <font color="red">attach SA to a process, core, or remote debug server</font>
         buildreplayjars [all | boot | app] <font color="red">build jars for replay, boot.jar for bootclasses, app.jar for application classes</font>
         class name <font color="red">find a Java class from debuggee and print oop</font>
         classes <font color="red">print all loaded Java classes with Klass*</font>

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              ysuenaga Yasumasa Suenaga
              Reporter:
              ysuenaga Yasumasa Suenaga
              Reviewed By:
              Chris Plummer
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: