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

Missing SP value in Linux x86_32 thread context

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 20
    • 11, 17, 19, 20
    • hotspot
    • None
    • b19

    Description

      Manifests with recently added test on x86_32:

      $ CONF=linux-x86-server-fastdebug make test TEST=serviceability/sa/ClhsdbThreadContext.java

      ...

      Thread "SteadyStateThread" id=2303604 Address=0xa52d32e0
      GS: 0x00000063
      FS: null
      ES: 0x0000002b
      DS: 0x0000002b
      EDI: null
      ESI: 0xa3e7cb40: In java stack [0xa3e7e000,null,0xa3e2e000] for thread sun.jvm.hotspot.runtime.JavaThread@0xa52d32e0:
         "SteadyStateThread" #19 prio=5 tid=0xa52d32e0 nid=2303604 waiting for monitor entry [0xa3e7c000]
         java.lang.Thread.State: BLOCKED (on object monitor)
         JavaThread state: _thread_blocked
      EBP: 0xffffffff
      ESP: null
      EBX: 0xa52d3a68
      EDX: null
      ECX: 0x00000089
      EAX: 0xfffffdfc
      TRAPNO: null
      ERR: null
      EIP: 0xf7f38549
      CS: 0x00000023
      EFLAGS: null
      UESP: 0xa3e7cb08: In java stack [0xa3e7e000,null,0xa3e2e000] for thread sun.jvm.hotspot.runtime.JavaThread@0xa52d32e0:
         "SteadyStateThread" #19 prio=5 tid=0xa52d32e0 nid=2303604 waiting for monitor entry [0xa3e7c000]
         java.lang.Thread.State: BLOCKED (on object monitor)
         JavaThread state: _thread_blocked


      java.lang.RuntimeException: Test ERROR java.lang.RuntimeException: 'In java stack \[0x\p{XDigit}+,0x\p{XDigit}+,0x\p{XDigit}+\] for thread' missing from stdout/stderr
      ```

      The test fails because debugger output prints `null` in `[0xa3e7e000,null,0xa3e2e000]`, which is read from ESP. However, we actually populate only `SP`, which is the alias to `UESP`, *not* `ESP`, in `Java_sun_jvm_hotspot_debugger_linux_LinuxDebuggerLocal_getThreadIntegerRegisterSet0`. See the snippet above: `UESP` is definitely there.

      `UESP` is user stack pointer in Solaris, `sp_at_signal` in Linux. It looks to me from Linux sources that `sp_at_signal` is always populated with the same value as `sp`. So we either need to populate `ESP` from `get_lwp_regs` input, or we should pull from `SP` (which is aliased to `UESP`) in `*X86JavaThreadPDAccess.getLastSP()`. Prior work in JDK-8208091 did the latter.

      Attachments

        Issue Links

          Activity

            People

              shade Aleksey Shipilev
              shade Aleksey Shipilev
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: