RFR: 8353365: TOUCH_ASSERT_POISON clears GetLastError()

Kim Barrett kbarrett at openjdk.org
Fri Apr 4 07:51:48 UTC 2025


On Fri, 4 Apr 2025 05:43:36 GMT, David Holmes <dholmes 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.

Changes requested by kbarrett (Reviewer).

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());

Why is this casting the value of GetLastError, rather than using "%u" in the format string?

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

PR Review: https://git.openjdk.org/jdk/pull/24435#pullrequestreview-2742118311
PR Review Comment: https://git.openjdk.org/jdk/pull/24435#discussion_r2028292231


More information about the hotspot-dev mailing list