src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windows/x86/WindowsX86CFrame.java
changeset 51518 2e98c7737d8f
parent 47216 71c04702a3d5
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windows/x86/WindowsX86CFrame.java	Fri Aug 24 14:04:34 2018 +0200
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windows/x86/WindowsX86CFrame.java	Mon Jul 23 18:08:46 2018 +0200
@@ -46,7 +46,15 @@
 
   public CFrame sender(ThreadProxy thread) {
     X86ThreadContext context = (X86ThreadContext) thread.getContext();
-    Address esp = context.getRegisterAsAddress(X86ThreadContext.ESP);
+    /*
+     * Native code fills in the stack pointer register value using index
+     * X86ThreadContext.SP.
+     * See file sawindbg.cpp macro REG_INDEX(x).
+     *
+     * Be sure to use SP, or UESP which is aliased to SP in Java code,
+     * for the frame pointer validity check.
+     */
+    Address esp = context.getRegisterAsAddress(X86ThreadContext.SP);
 
     if ( (ebp == null) || ebp.lessThan(esp) ) {
       return null;