RFR: 8373615: Improve HotSpot debug functions findclass() and findmethod [v4]

Ashutosh Mehra asmehra at openjdk.org
Mon Dec 15 21:31:03 UTC 2025


On Mon, 15 Dec 2025 19:23:08 GMT, Ioi Lam <iklam at openjdk.org> wrote:

>> I used the `findclass` and `findmethod` functions in debug.cpp  a lot when debugging problems with class metadata.
>> 
>> https://github.com/openjdk/jdk/blob/6ec36d348b1eaeedb993a905e42650242fac0918/src/hotspot/share/utilities/debug.cpp#L583-L603 
>> 
>> This REF improves these functions by:
>> 
>> - Sorting the names of classes and methods
>> - Allow "." to be used in class names. So both `findclass("java.lang.Object")` and `findclass("java/lang/Object")` would work
>> - Print the C++/Java objects that represent classes and methods.
>
> Ioi Lam has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains six additional commits since the last revision:
> 
>  - Merge branch 'master' into 8373615-improve-findclass-and-findmethod
>  - Fixed regex test problems on Windows
>  - Fixed test and added more test cases
>  - sort includes
>  - @ashu-mehra and @matias9927 review comments
>  - 8373615: Improve HotSpot debug functions findclass() and findmethod

test/hotspot/gtest/runtime/test_classPrinter.cpp line 88:

> 86: 
> 87: #ifndef PRODUCT
> 88:   // These are available only in debug builds

Sorry for nitpicking but I see `PRINT_BYTECODE` and `PRINT_BYTECODE_ADDRESS` are available in product builds, only `PRINT_METHOD_DETAILS` relies on method present in debug build. Or did I miss something?

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/28796#discussion_r2620911462


More information about the hotspot-runtime-dev mailing list