RFR: 8342893: Highlight special values in hserr file printing [v5]

Ludvig Janiuk lujaniuk at openjdk.org
Mon Nov 25 16:57:19 UTC 2024


On Thu, 14 Nov 2024 13:07:40 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:

>> There are some special values indicating memory corruption or problematic states. Those should be highlighted / pointed out in some way when printing parts of the hserr / hsinfo file (like register values or locations),
>
> Matthias Baesken has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains six commits:
> 
>  - Merge master
>  - Merge remote-tracking branch 'origin/master' into JDK-8342893
>  - Introduce badResourceValueWord variable
>  - compile error on Linux x86 and arm 32bit
>  - do checks in debug
>  - JDK-8342893

Maybe the new `os::print_reg` could be covered by some unit tests? For comparison, I managed to add the following to `test/hotspot/gtest/utilities/test_vmerror.cpp`:


TEST_VM(vmErrorTest, reg) {
  char* actual = NEW_C_HEAP_ARRAY(char, 200, mtInternal);
  stringStream ss(actual, 200);
  os::print_dhm(&ss, "ludvig ", 1);
  
  const char* reference = "ludvig  0 days 0:00 hours\n";
  EXPECT_STREQ(actual, reference);
}


Sample output (where I made it fail on purpose):


[ RUN      ] vmErrorTest.reg_vm
***/test/hotspot/gtest/utilities/test_vmerror.cpp:132: Failure
Expected equality of these values:
  actual
    Which is: "not ludvig  0 days 0:00 hours\n"
  reference
    Which is: "ludvig  0 days 0:00 hours\n"

[  FAILED  ] vmErrorTest.reg_vm (0 ms)
[----------] 13 tests from vmErrorTest (2170 ms total)

Otherwise I think it's a really nice enhancement to make these values stand out better!

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

PR Comment: https://git.openjdk.org/jdk/pull/21811#issuecomment-2498544480
PR Comment: https://git.openjdk.org/jdk/pull/21811#issuecomment-2498546575


More information about the hotspot-dev mailing list