Skip to content

8375534: Debug method 'pp' should support compressed oops#29280

Closed
TobiHartmann wants to merge 2 commits intoopenjdk:masterfrom
TobiHartmann:JDK-8375534
Closed

8375534: Debug method 'pp' should support compressed oops#29280
TobiHartmann wants to merge 2 commits intoopenjdk:masterfrom
TobiHartmann:JDK-8375534

Conversation

@TobiHartmann
Copy link
Member

@TobiHartmann TobiHartmann commented Jan 16, 2026

The debug method pp is currently not able to handle compressed oops. This should fix it. The code is similar to BlockLocationPrinter<CollectedHeapT>::print_location.

Before:

(rr) call (void*) pp(0x6b9c08fc8)

"Executing pp"
java.lang.Runtime$Version 
{0x00000006b9c08fc8} - klass: 'java/lang/Runtime$Version' - flags: 

 - ---- fields (total size 4 words):
 - private final value 'version' 'Ljava/util/List;' @12  a 'java/util/ImmutableCollections$List12'{0x00000006b9c2cbb8} (0xd7385977)
 - private final value 'pre' 'Ljava/util/Optional;' @16  a 'java/util/Optional'{0x00000006b9c2cbd0} (0xd738597a)
 - private final value 'build' 'Ljava/util/Optional;' @20  a 'java/util/Optional'{0x00000006b9c0a118} (0xd7381423)
 - private final value 'optional' 'Ljava/util/Optional;' @24  a 'java/util/Optional'{0x00000006b9c2cbe8} (0xd738597d)
$1 = (void *) 0x0
(rr) call (void*) pp(0xd7381423)

"Executing pp"
The program being debugged received signal SIGSEGV, Segmentation fault
while in a function called from GDB.  GDB has restored the context
to what it was before the call.  To change this behavior use
"set unwind-on-signal off".  Evaluation of the expression containing
the function (pp(long)) will be abandoned.

After:


"Executing pp"
java.lang.Runtime$Version 
{0x00000006b9c08fc8} - klass: 'java/lang/Runtime$Version' - flags: 

 - ---- fields (total size 4 words):
 - private final value 'version' 'Ljava/util/List;' @12  a 'java/util/ImmutableCollections$List12'{0x00000006b9c2cbb8} (0xd7385977)
 - private final value 'pre' 'Ljava/util/Optional;' @16  a 'java/util/Optional'{0x00000006b9c2cbd0} (0xd738597a)
 - private final value 'build' 'Ljava/util/Optional;' @20  a 'java/util/Optional'{0x00000006b9c0a118} (0xd7381423)
 - private final value 'optional' 'Ljava/util/Optional;' @24  a 'java/util/Optional'{0x00000006b9c2cbe8} (0xd738597d)
$1 = (void *) 0x0
(rr) call (void*) pp(0xd7381423)

"Executing pp"
3610776611 is a compressed pointer to object: java.util.Optional 
{0x00000006b9c0a118} - klass: 'java/util/Optional' - flags: 

 - ---- fields (total size 3 words):
 - private final value 'value' 'Ljava/lang/Object;' @16  null (0x00000000)
$2 = (void *) 0x0

Thanks,
Tobias


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-8375534: Debug method 'pp' should support compressed oops (Enhancement - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 29280

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jan 16, 2026

👋 Welcome back thartmann! 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 16, 2026

@TobiHartmann 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:

8375534: Debug method 'pp' should support compressed oops

Reviewed-by: vlivanov, phubner

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 209 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 hotspot hotspot-dev@openjdk.org label Jan 16, 2026
@openjdk
Copy link

openjdk bot commented Jan 16, 2026

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

  • hotspot

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.

@openjdk openjdk bot added the rfr Pull request is ready for review label Jan 16, 2026
@mlbridge
Copy link

mlbridge bot commented Jan 16, 2026

Webrevs

Copy link
Contributor

@iwanowww iwanowww left a comment

Choose a reason for hiding this comment

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

Overall, looks good.

BlockLocationPrinter<CollectedHeapT>::print_location() has very similar code, but uses a more elaborate check in place of Universe::heap()->is_in(o). Any particular reason LocationPrinter::is_valid_obj() doesn't fit pp()? Otherwise, it makes sense to unify the code.

@TobiHartmann
Copy link
Member Author

Thanks for the review, Vladimir. You are right and when looking at the code again, I noticed that we can just call Universe::heap()->print_location from pp. I'm not so sure anymore how valuable pp really is, given that there is find which entails the functionality of pp. But let's fix it for now.

Copy link
Member

@Arraying Arraying left a comment

Choose a reason for hiding this comment

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

This is a super useful change, thanks for doing it. One small comment.

obj->print();
} else {

if (!Universe::heap()->print_location(tty, p)) {
Copy link
Member

Choose a reason for hiding this comment

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

FYI, we also have os::print_location which adds a few extra goodies (nullcheck + code blob check). Its documentation mentions

// moved from debug.cpp (used to be find()) but still called from there

I'm happy with the current code and I'd also be okay with using the os version, I just wanted to point it out in case you think one is more appropriate than the other.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for taking a look at this. Yes, I've seen that and it's already used by find and findpc. I think the intention of pp is that we already know/expect that the argument is a pointer into the Java heap and therefore want to limit the amount of checks (maybe for performance or stability reasons?) during debugging.

Copy link
Contributor

@iwanowww iwanowww left a comment

Choose a reason for hiding this comment

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

Looks good.

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

@franciscoarturorivera371-cyber franciscoarturorivera371-cyber left a comment

Choose a reason for hiding this comment

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

Hi @franciscoarturorivera371-cyber, thanks for making a comment in an OpenJDK project!

All comments and discussions in the OpenJDK Community must be made available under the OpenJDK Terms of Use. If you already are an OpenJDK Author, Committer or Reviewer, please click here to open a new issue so that we can record that fact. Please Use "Add GitHub user franciscoarturorivera371-cyber" for the summary.

If you are not an OpenJDK Author, Committer or Reviewer, simply check the box below to accept the OpenJDK Terms of Use for your comments.

Your comment will be automatically restored once you have accepted the OpenJDK Terms of Use.

@TobiHartmann
Copy link
Member Author

Thanks Vladimir!

@TobiHartmann
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Jan 22, 2026

Going to push as commit 0f4d775.
Since your change was applied there have been 219 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 22, 2026
@openjdk openjdk bot closed this Jan 22, 2026
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jan 22, 2026
@openjdk
Copy link

openjdk bot commented Jan 22, 2026

@TobiHartmann Pushed as commit 0f4d775.

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

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

Labels

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

Development

Successfully merging this pull request may close these issues.

4 participants