Skip to content

Conversation

@shipilev
Copy link
Member

@shipilev shipilev commented Jan 6, 2026

JDK-8374507 forced me to look into debug info sizes again. And I remembered that GCC actually have debug-level support, which can select what kind of diagnostic data is in the debug info. See: https://gcc.gnu.org/onlinedocs/gcc-4.5.0/gcc/Debugging-Options.html

Allowing users to configure the debug level allows two major deviations from the default level (2):
level=1: significantly reduce the debug info size, but still allow backtrace reconstruction
level=3: add even more debugging info, like macro expansion, into the debug data

This RFE upstreams the variant the patch that I have been using in builds.shipilev.net binaries: the fastdebug variants there are done with GCC level=1, greatly optimizing the debug binary sizes, while still maintaining the major benefit of debug binaries -- rich crash diagnostics.

I threw in this option into current GHA builds to conserve more disk space on runners and/or transfers.

I am open for bikeshedding on the option name :)


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8374521: Support fine-grained native debug levels (Enhancement - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/29056/head:pull/29056
$ git checkout pull/29056

Update a local copy of the PR:
$ git checkout pull/29056
$ git pull https://git.openjdk.org/jdk.git pull/29056/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 29056

View PR using the GUI difftool:
$ git pr show -t 29056

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/29056.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jan 6, 2026

👋 Welcome back shade! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Jan 6, 2026

@shipilev This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8374521: Support fine-grained native debug levels

Reviewed-by: erikj, krk, clanger

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 18 new commits pushed to the master branch:

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the build build-dev@openjdk.org label Jan 6, 2026
@openjdk
Copy link

openjdk bot commented Jan 6, 2026

@shipilev The following label will be automatically applied to this pull request:

  • build

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@shipilev
Copy link
Member Author

shipilev commented Jan 6, 2026

Motivational improvements in debug info sizes:

$ ls -sh ./build/linux-x86_64-server-fastdebug/images/jdk/lib/server/libjvm.debuginfo
# level=1: 144M
# level=2: 860M
# level=3: 892M

Since debuginfo-s are duplicated several times in our build dir, we are scratching against the 14G guaranteed free space on GHA runners, and reducing to level=1 buys us a lot of headroom:

$ du -sh build/linux-x86_64-server-fastdebug/
# level=1:  4.0G
# level=2: 14.0G
# level=3: 16.0G

@shipilev
Copy link
Member Author

shipilev commented Jan 6, 2026

Similar thing on MacOS AArch64 (Clang):

% du -sh ./build/macosx-aarch64-server-fastdebug/images/jdk/lib/server/libjvm.dylib.dSYM/ 
# level=1:  92M
# level=2: 202M
# level=3: 202M

% du -sh ./build/macosx-aarch64-server-fastdebug/     
# level=1: 3.6G
# level=2: 5.6G
# level=3: 5.6G

@shipilev shipilev marked this pull request as ready for review January 6, 2026 13:15
@openjdk openjdk bot added the rfr Pull request is ready for review label Jan 6, 2026
@mlbridge
Copy link

mlbridge bot commented Jan 6, 2026

Webrevs

# Debug prefix mapping if supported by compiler
DEBUG_PREFIX_CFLAGS=
UTIL_ARG_WITH(NAME: fine-debug-level, TYPE: string,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about debug-info-level?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I agree with this naming suggestion.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--with-debug-info-level it is!

Copy link
Member

@erikj79 erikj79 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a good idea.

# Debug prefix mapping if supported by compiler
DEBUG_PREFIX_CFLAGS=
UTIL_ARG_WITH(NAME: fine-debug-level, TYPE: string,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I agree with this naming suggestion.

UTIL_ARG_WITH(NAME: fine-debug-level, TYPE: string,
DEFAULT: 2,
RESULT: FINE_DEBUG_LEVEL,
DESC: [Sets the fine-tuned debug level, when debug info generation is enabled],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should clarify that this only applies to GCC and Clang.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the blurb into description.

@shipilev
Copy link
Member Author

shipilev commented Jan 6, 2026

A few more touchups: moved the block to handle both compilers at the same time, stopped issuing -g2 when default -g would do, started to fail when compiler rejects the debug info level requested.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jan 6, 2026
Copy link
Contributor

@RealCLanger RealCLanger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a nice resource usage improvement

@shipilev
Copy link
Member Author

shipilev commented Jan 7, 2026

Thanks for reviews! I am thinking to align the option name with current --with-native-debug-symbols better, since it is really about those. How about this?

  --with-native-debug-symbols-level
                          set the native debug symbols level (GCC and Clang only) [toolchain default]
  --with-native-debug-symbols
                          set the native debug symbol configuration (none,
                          internal, external, zipped) [varying]

@RealCLanger
Copy link
Contributor

OK, yes, that sounds like a good suggestion.

@erikj79
Copy link
Member

erikj79 commented Jan 7, 2026

Thanks for reviews! I am thinking to align the option name with current --with-native-debug-symbols better, since it is really about those. How about this?

Yes, that looks even better.

@shipilev
Copy link
Member Author

shipilev commented Jan 7, 2026

Thanks! Here goes.

/integrate

@openjdk
Copy link

openjdk bot commented Jan 7, 2026

Going to push as commit dd20e91.
Since your change was applied there have been 30 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jan 7, 2026
@openjdk openjdk bot closed this Jan 7, 2026
@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Jan 7, 2026
@openjdk openjdk bot removed the rfr Pull request is ready for review label Jan 7, 2026
@openjdk
Copy link

openjdk bot commented Jan 7, 2026

@shipilev Pushed as commit dd20e91.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@RealCLanger
Copy link
Contributor

Thanks! Here goes.

/integrate

OK, no --with-native-debug-symbols-level then?

@shipilev
Copy link
Member Author

shipilev commented Jan 7, 2026

Thanks! Here goes.
/integrate

OK, no --with-native-debug-symbols-level then?

Dang. I have not pushed my local commit! Argh. I'll follow up with the update tomorrow.

@shipilev
Copy link
Member Author

shipilev commented Jan 8, 2026

Dang. I have not pushed my local commit! Argh. I'll follow up with the update tomorrow.

#29108

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build build-dev@openjdk.org integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

4 participants