RFR: 8353365: TOUCH_ASSERT_POISON clears GetLastError()

Julian Waters jwaters at openjdk.org
Fri Apr 4 07:57:54 UTC 2025


On Fri, 4 Apr 2025 07:48:12 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

>> test/hotspot/gtest/utilities/test_vmerror.cpp line 38:
>> 
>>> 36:                    "fatal error: GetLastError should be 6 - actually: 6") {
>>> 37:   SetLastError(6);
>>> 38:   fatal("GetLastError should be 6 - actually: %d", (int)GetLastError());
>> 
>> I wonder if HotSpot has a preference for the more specific C++ casts. Also, wouldn't it be better to check the value of GetLastError after fatal is called rather than comparing the strings (I assume that's what the TEST_VM_ASSERT_MSG is doing)?
>
> @TheShermanTanker - This test is checking the problem use-case that led to this change, where the
> value of the `GetLastError` call was clobbered when done as an argument to `fatal`, because the
> `TOUCH_ASSERT_POISON` happened before the call to `GetLastError`.

Ah, alright. Thanks for the explanation

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24435#discussion_r2028306628


More information about the hotspot-dev mailing list