> This change enables debug.cpp's find() utility to print Java Objects with > their fields. > > find() calls os::print_location, and Java heap objects are printed with > instanceKlass oop_print_on. > Removing the ifdef for defining oop_print_on for instanceKlass, and also on > methods in FieldPrinter and FieldDescriptor, make this work. > > > Checking other uses of os::print_location this might affect: > > macroAssembler_x86.cpp has MacroAssembler::print_state32 and > MacroAssembler::print_state64 > which use os::print_location to print register contents and print words at > top of stack. > These will be more verbose, as it already is in non-PRODUCT builds. > > vmError uses os::print_location when showing the stack, i.e. this output: > > Stack slot to memory mapping: > stack at sp + 0 slots: 0x0000000000000002 is an unknown value > ..etc... > > ...will be more verbose when Java object references are found (for the 8 > stack slots it tries to show). > > > Shenandoah uses os::print_location once, but for non-Java heap objects so > nothing changes. > > > Manual testing on Linux-x64 and Windows: old behaviour shows these two lines > only: > > "Executing find" > 0x00000000ff0a03e0 is an oop: jdk.internal.loader.ClassLoaders$AppClassLoader > {0x00000000ff0a03e0} - klass: > 'jdk/internal/loader/ClassLoaders$AppClassLoader' > > ...then with the change the full info: > > "Executing find" > 0x00000000ff0a03e0 is an oop: jdk.internal.loader.ClassLoaders$AppClassLoader > {0x00000000ff0a03e0} - klass: > 'jdk/internal/loader/ClassLoaders$AppClassLoader' > - ---- fields (total size 13 words): > - private 'defaultAssertionStatus' 'Z' @12 false > - private final 'parent' 'Ljava/lang/ClassLoader;' @24 a > 'jdk/internal/loader/ClassLoaders$PlatformClassLoader'{0x00000000ff0a0a > 40} (ff0a0a40) > - private final 'name' 'Ljava/lang/String;' @28 "app"{0x00000000ff0d0060} > (ff0d0060) > - private final 'unnamedModule' 'Ljava/lang/Module;' @32 a > 'java/lang/Module'{0x00000000ff0a0448} (ff0a0448) > ...etc...
Kevin Walls 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 three additional commits since the last revision: - Merge remote-tracking branch 'upstream/master' into 8266967_objectprint - ifdef correction - 8266967: debug.cpp utility find() should print Java Object fields. ------------- Changes: - all: https://git.openjdk.java.net/jdk/pull/4011/files - new: https://git.openjdk.java.net/jdk/pull/4011/files/f6454294..a1170727 Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=4011&range=02 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=4011&range=01-02 Stats: 578299 lines in 4725 files changed: 494681 ins; 69830 del; 13788 mod Patch: https://git.openjdk.java.net/jdk/pull/4011.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/4011/head:pull/4011 PR: https://git.openjdk.java.net/jdk/pull/4011