RFR: 8353365: TOUCH_ASSERT_POISON clears GetLastError()
Kim Barrett
kbarrett at openjdk.org
Fri Apr 4 07:51:49 UTC 2025
On Fri, 4 Apr 2025 07:37:35 GMT, Julian Waters <jwaters at openjdk.org> wrote:
>> This is a very simple fix to save/restore the "last error" value on Windows, so that the TOUCH_ASSERT_POISON mechanism used in assert/guarantee/fatal, does not clear it.
>>
>> Testing
>> - new Windows-only gtest added to vmErrors test group
>> - tiers 103 sanity
>>
>> Thanks.
>
> 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`.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24435#discussion_r2028296656
More information about the hotspot-dev
mailing list