Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8353365

TOUCH_ASSERT_POISON clears GetLastError()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 25
    • 25
    • hotspot
    • b18

      When calling Windows APIs you often need fetch the error code by calling GetLastError(). So, it is quite common to write code like the following:

      fatal(msg ": " PTR_FORMAT " %zuM (%d)", (addr), (size) / M, GetLastError())

      However, the last time I hit one of these errors the error code was returned as 0:

      # fatal error: Failed to unreserve memory: 0x0000040000200000 2M (0)

      The expected error code in that run was 87, not 0.

      I've pin-pointed it down to be caused by the TOUCH_ASSERT_POISON mechanism that causes this:

      #define fatal(...) \
      do { \
        TOUCH_ASSERT_POISON; \
        report_fatal(INTERNAL_ERROR, __FILE__, __LINE__, __VA_ARGS__); \
      } while (0)

      If I remove the TOUCH_ASSERT_POISON I get the expected error code.

            dholmes David Holmes
            stefank Stefan Karlsson
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: