hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/windows/x86/WindowsX86CFrame.java
author mikael
Tue, 24 Dec 2013 11:48:39 -0800
changeset 22234 da823d78ad65
parent 17600 a5424f23dbf0
permissions -rw-r--r--
8029233: Update copyright year to match last edit in jdk8 hotspot repository for 2013 Summary: Copyright year updated for files modified during 2013 Reviewed-by: twisti, iveresov
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
22234
da823d78ad65 8029233: Update copyright year to match last edit in jdk8 hotspot repository for 2013
mikael
parents: 17600
diff changeset
     2
 * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
17600
a5424f23dbf0 6313816: SA: jstack -m fails on Win32 : UnalignedAddressException
kevinw
parents: 13088
diff changeset
    25
package sun.jvm.hotspot.debugger.windows.x86;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    26
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
import sun.jvm.hotspot.debugger.*;
13088
6d7b2029e597 6310967: SA: jstack -m produce failures in output
poonam
parents: 5547
diff changeset
    28
import sun.jvm.hotspot.debugger.x86.*;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
import sun.jvm.hotspot.debugger.cdbg.*;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
import sun.jvm.hotspot.debugger.cdbg.basic.*;
17600
a5424f23dbf0 6313816: SA: jstack -m fails on Win32 : UnalignedAddressException
kevinw
parents: 13088
diff changeset
    31
import sun.jvm.hotspot.debugger.windbg.*;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
17600
a5424f23dbf0 6313816: SA: jstack -m fails on Win32 : UnalignedAddressException
kevinw
parents: 13088
diff changeset
    33
public class WindowsX86CFrame extends BasicCFrame {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
  private Address ebp;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
  private Address pc;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
  private static final int ADDRESS_SIZE = 4;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
  /** Constructor for topmost frame */
17600
a5424f23dbf0 6313816: SA: jstack -m fails on Win32 : UnalignedAddressException
kevinw
parents: 13088
diff changeset
    40
  public WindowsX86CFrame(WindbgDebugger dbg, Address ebp, Address pc) {
a5424f23dbf0 6313816: SA: jstack -m fails on Win32 : UnalignedAddressException
kevinw
parents: 13088
diff changeset
    41
    super(dbg.getCDebugger());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
    this.ebp = ebp;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
    this.pc  = pc;
17600
a5424f23dbf0 6313816: SA: jstack -m fails on Win32 : UnalignedAddressException
kevinw
parents: 13088
diff changeset
    44
    this.dbg = dbg;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
13088
6d7b2029e597 6310967: SA: jstack -m produce failures in output
poonam
parents: 5547
diff changeset
    47
  public CFrame sender(ThreadProxy thread) {
6d7b2029e597 6310967: SA: jstack -m produce failures in output
poonam
parents: 5547
diff changeset
    48
    X86ThreadContext context = (X86ThreadContext) thread.getContext();
6d7b2029e597 6310967: SA: jstack -m produce failures in output
poonam
parents: 5547
diff changeset
    49
    Address esp = context.getRegisterAsAddress(X86ThreadContext.ESP);
6d7b2029e597 6310967: SA: jstack -m produce failures in output
poonam
parents: 5547
diff changeset
    50
6d7b2029e597 6310967: SA: jstack -m produce failures in output
poonam
parents: 5547
diff changeset
    51
    if ( (ebp == null) || ebp.lessThan(esp) ) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
      return null;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
17600
a5424f23dbf0 6313816: SA: jstack -m fails on Win32 : UnalignedAddressException
kevinw
parents: 13088
diff changeset
    55
    // Check alignment of ebp
a5424f23dbf0 6313816: SA: jstack -m fails on Win32 : UnalignedAddressException
kevinw
parents: 13088
diff changeset
    56
    if ( dbg.getAddressValue(ebp) % ADDRESS_SIZE != 0) {
a5424f23dbf0 6313816: SA: jstack -m fails on Win32 : UnalignedAddressException
kevinw
parents: 13088
diff changeset
    57
        return null;
a5424f23dbf0 6313816: SA: jstack -m fails on Win32 : UnalignedAddressException
kevinw
parents: 13088
diff changeset
    58
    }
a5424f23dbf0 6313816: SA: jstack -m fails on Win32 : UnalignedAddressException
kevinw
parents: 13088
diff changeset
    59
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
    Address nextEBP = ebp.getAddressAt( 0 * ADDRESS_SIZE);
17600
a5424f23dbf0 6313816: SA: jstack -m fails on Win32 : UnalignedAddressException
kevinw
parents: 13088
diff changeset
    61
    if (nextEBP == null || nextEBP.lessThanOrEqual(ebp)) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
      return null;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
    Address nextPC  = ebp.getAddressAt( 1 * ADDRESS_SIZE);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
    if (nextPC == null) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
      return null;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
    }
17600
a5424f23dbf0 6313816: SA: jstack -m fails on Win32 : UnalignedAddressException
kevinw
parents: 13088
diff changeset
    68
    return new WindowsX86CFrame(dbg, nextEBP, nextPC);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  public Address pc() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
    return pc;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  public Address localVariableBase() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
    return ebp;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
  }
17600
a5424f23dbf0 6313816: SA: jstack -m fails on Win32 : UnalignedAddressException
kevinw
parents: 13088
diff changeset
    78
a5424f23dbf0 6313816: SA: jstack -m fails on Win32 : UnalignedAddressException
kevinw
parents: 13088
diff changeset
    79
  private WindbgDebugger dbg;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
}