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

Add --strip-java-debug-attributes jlink option

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 13
    • tools
    • None
    • behavioral
    • minimal
    • Hide
      Currently the risk is none as --strip-debug will perform the same as it performed prior this patch. Only after JDK-8214796, --strip-debug does more than what it did before. For users only wanting Java debug symbols stripping, --strip-java-debug-attributes will be available.
      Show
      Currently the risk is none as --strip-debug will perform the same as it performed prior this patch. Only after JDK-8214796 , --strip-debug does more than what it did before. For users only wanting Java debug symbols stripping, --strip-java-debug-attributes will be available.
    • add/remove/modify command line option
    • JDK

      Summary

      Add jlink option --strip-java-debug-attributes. Currently the same behaviour is available via option --strip-debug, which might gain additional functionality, such as stripping native debug symbols, in the future.

      Problem

      While working on JDK-8214796, which introduces a mechanism for stripping native debug symbols from executables and shared libraries, it was observed that there exists a more generic --strip-debug option already. However, that version currently only strips Java debug attributes from class files. For one, the current --strip-debug option seems misleading as it's not clear which debug information is actually being stripped. That's the reason why it was suggested to move the current --strip-debug plugin functionality to a more telling name, --strip-java-debug-attributes. This would then open up the possibility of --strip-debug to perform more than just Java debug attributes stripping. One such candidate of additional stripping performed by --strip-debug would be stripping of native debug symbols from executables and shared libraries.

      Solution

      The proposed solution moves current functionality of stripping Java debug attributes from class files to a new plugin, invoked via --strip-java-debug-attributes. Initially, --strip-debug will delegate to --strip-java-debug-attributes. In a future version --strip-debug might also invoke a plugin for native debug symbols stripping (See JDK-8214796).

      An alternative solution would be to keep --strip-debug as is and only add --strip-native-debug-symbols via JDK-8214796. This has the drawback of not being able to implement --strip-debug as a compound command to invoke both, --strip-debug and --strip-native-debug-symbols as well as it being not very clear. --strip-debug help keeps its workings rather broad via its description: "Strip debug information from the output image". It seems misleading to only strip Java debug attributes for an implementation of this plugin.

      References to relevant review discussions:

      --strip-debug inconsistency is being noted here: http://mail.openjdk.java.net/pipermail/jigsaw-dev/2019-February/014118.html

      Rename of --strip-debug is being suggested as a pre-requisite of --strip-native-debug-symbols here: http://mail.openjdk.java.net/pipermail/jigsaw-dev/2019-February/014118.html

      Specification

      jlink's --list-plugins output will include this output for --strip-java-debug-attributes:

       Plugin Name: strip-java-debug-attributes
       Option: --strip-java-debug-attributes
       Description: Strip Java debug attributes from classes in the output image

      --strip-debug help output will remain as is:

      Plugin Name: strip-debug
      Option: --strip-debug
      Description: Strip debug information from the output image

            sgehwolf Severin Gehwolf
            sgehwolf Severin Gehwolf
            Alan Bateman, Mandy Chung (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: