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

Add --servername option to jhsdb debugd

    XMLWordPrintable

Details

    • CSR
    • Resolution: Approved
    • P4
    • 17
    • hotspot
    • None
    • behavioral
    • minimal
    • Added support for RMI object name in each remote debug sub-commands in jhsdb. And also system property which has not been described is deprecated. They do not impact usual behavior.
    • add/remove/modify command line option
    • JDK

    Description

      Summary

      Add --servername option to debugd sub-command in jhsdb to specify RMI URL prefix for SA. And also add the way to specify it in client side. And also deprecate sun.jvm.hotspot.rmi.serverNamePrefix system property. It has been used for this purpose, but it has not been described in any place, and the name is not suitable.

      Problem

      jhsdb debugd exports RMI object to communicate with remote debugger client. Multiple RMI objects can be hosted in same RMI registry. We can specify the prefix to distinguish debugee in that case. We can use sun.jvm.hotspot.rmi.serverNamePrefix system property, however jhsdb does not provide command line option for it - we need to set it with -J-D.

      Solution

      Add --servername option to debugd subcommand. We can see it on help message of debugd as following:

      $ jhsdb debugd --help
          --serverid <id>         A unique identifier for this debug server.
          --servername <name>     Instance name of debugd server.
          --rmiport <port>        Sets the port number to which the RMI connector is bound. If not specified a random available port is used.
          --registryport <port>   Sets the RMI registry port. This option overrides the system property 'sun.jvm.hotspot.rmi.port'. If not specified, the system property is used. If the system property is not set, the default port 1099 is used.
          --disable-registry      Do not start RMI registry (use already started RMI registry)
          --hostname <hostname>   Sets the hostname the RMI connector is bound. The value could be a hostname or an IPv4/IPv6 address. This option overrides the system property 'java.rmi.server.hostname'. If not specified, the system property is used. If the system property is not set, a system hostname is used.
          --pid <pid>             To attach to and operate on the given live process.
          --core <corefile>       To operate on the given core file.
          --exe <executable for corefile>
      
          The --core and --exe options must be set together to give the core
          file, and associated executable, to operate on. They can use
          absolute or relative paths.
          The --pid option can be set to operate on a live process.
          --core and --pid are mutually exclusive.
      
          Examples: jhsdb debugd --pid 1234
                or  jhsdb debugd --core ./core.1234 --exe ./myexe

      And also add server name support to all of --connect option as following. We can specify it with the following "/":

      --connect [<serverid>@]<host>[:registryport][/servername] To connect to a remote debug server (debugd).

      Specification

      --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/SALauncher.java
      +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/SALauncher.java
      @@ -68,7 +68,7 @@ public class SALauncher {
               System.out.println("    --core <corefile>       To operate on the given core file.");
               System.out.println("    --exe <executable for corefile>");
               if (canConnectToRemote) {
      -            System.out.println("    --connect [<id>@]<host>[:registryport][/prefix] To connect to a remote debug server (debugd).");
      +            System.out.println("    --connect [<serverid>@]<host>[:registryport][/servername] To connect to a remote debug server (debugd).");
               }
               System.out.println();
               System.out.println("    The --core and --exe options must be set together to give the core");
      @@ -85,14 +85,12 @@ public class SALauncher {
               System.out.println("    Examples: jhsdb " + mode + " --pid 1234");
               System.out.println("          or  jhsdb " + mode + " --core ./core.1234 --exe ./myexe");
               if (canConnectToRemote) {
      -            System.out.println("          or  jhsdb " + mode + " --connect id@debugserver:1234/prefix");
      +            System.out.println("          or  jhsdb " + mode + " --connect serverid@debugserver:1234/servername");
               }
               return false;
           }
      --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/SALauncher.java
      +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/SALauncher.java
      @@ -104,7 +102,7 @@ public class SALauncher {
                       " be a hostname or an IPv4/IPv6 address. This option overrides the system property" +
                       " 'java.rmi.server.hostname'. If not specified, the system property is used. If the system" +
                       " property is not set, a system hostname is used.");
      -        System.out.println("    --prefix   <url prefix> Sets the prefix to distinguish SA debugee.");
      +        System.out.println("    --servername <name>     Instance name of debugd server.");
               return commonHelp("debugd");
           }
      

      Attachments

        Issue Links

          Activity

            People

              ysuenaga Yasumasa Suenaga
              ysuenaga Yasumasa Suenaga
              Chris Plummer
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: