RFR: 8375534: Debug method 'pp' should support compressed oops [v2]
Paul Hübner
phubner at openjdk.org
Tue Jan 20 15:48:19 UTC 2026
On Mon, 19 Jan 2026 08:11:00 GMT, Tobias Hartmann <thartmann at openjdk.org> wrote:
>> 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:**
>> ```(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"
>> 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
>
> Tobias Hartmann has updated the pull request incrementally with one additional commit since the last revision:
>
> Let's just use print_location instead
This is a super useful change, thanks for doing it. One small comment.
src/hotspot/share/utilities/debug.cpp line 426:
> 424: }
> 425:
> 426: if (!Universe::heap()->print_location(tty, p)) {
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.
-------------
PR Review: https://git.openjdk.org/jdk/pull/29280#pullrequestreview-3682888141
PR Review Comment: https://git.openjdk.org/jdk/pull/29280#discussion_r2708939042
More information about the hotspot-dev
mailing list