src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/x86/X86CurrentFrameGuess.java
author cjplummer
Wed, 13 Nov 2019 13:05:16 -0800
changeset 59065 5f458adec06b
parent 47216 71c04702a3d5
permissions -rw-r--r--
8231635: SA Stackwalking code stuck in BasicTypeDataBase.findDynamicTypeForAddress() Summary: Better checking for invalid stack address when walking the stack frames Reviewed-by: sspitsyn, dtitov
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
59065
5f458adec06b 8231635: SA Stackwalking code stuck in BasicTypeDataBase.findDynamicTypeForAddress()
cjplummer
parents: 47216
diff changeset
     2
 * Copyright (c) 2001, 2019, 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
489c9b5090e2 Initial load
duke
parents:
diff changeset
    25
package sun.jvm.hotspot.runtime.x86;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    26
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
import sun.jvm.hotspot.debugger.*;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
import sun.jvm.hotspot.debugger.x86.*;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
import sun.jvm.hotspot.code.*;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
import sun.jvm.hotspot.interpreter.*;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
import sun.jvm.hotspot.runtime.*;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
/** <P> Should be able to be used on all x86 platforms we support
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
    (Win32, Solaris/x86, and soon Linux) to implement JavaThread's
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
    "currentFrameGuess()" functionality. Input is an X86ThreadContext;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
    output is SP, FP, and PC for an X86Frame. Instantiation of the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
    X86Frame is left to the caller, since we may need to subclass
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
    X86Frame to support signal handler frames on Unix platforms. </P>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
    <P> Algorithm is to walk up the stack within a given range (say,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
    512K at most) looking for a plausible PC and SP for a Java frame,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
    also considering those coming in from the context. If we find a PC
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
    that belongs to the VM (i.e., in generated code like the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
    interpreter or CodeCache) then we try to find an associated EBP.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
    We repeat this until we either find a complete frame or run out of
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
    stack to look at. </P> */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
public class X86CurrentFrameGuess {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
  private X86ThreadContext context;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
  private JavaThread       thread;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
  private Address          spFound;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
  private Address          fpFound;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
  private Address          pcFound;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
  private static final boolean DEBUG = System.getProperty("sun.jvm.hotspot.runtime.x86.X86Frame.DEBUG")
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
                                       != null;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  public X86CurrentFrameGuess(X86ThreadContext context,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
                              JavaThread thread) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
    this.context = context;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
    this.thread  = thread;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  /** Returns false if not able to find a frame within a reasonable range. */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  public boolean run(long regionInBytesToSearch) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
    Address sp  = context.getRegisterAsAddress(X86ThreadContext.SP);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
    Address pc  = context.getRegisterAsAddress(X86ThreadContext.PC);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
    Address fp  = context.getRegisterAsAddress(X86ThreadContext.FP);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
    if (sp == null) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
      // Bail out if no last java frame eithe
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
      if (thread.getLastJavaSP() != null) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
        setValues(thread.getLastJavaSP(), thread.getLastJavaFP(), null);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
        return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
      // Bail out
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
      return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
    Address end = sp.addOffsetTo(regionInBytesToSearch);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
    VM vm       = VM.getVM();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
    setValues(null, null, null); // Assume we're not going to find anything
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
    if (vm.isJavaPCDbg(pc)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
      if (vm.isClientCompiler()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
        // If the topmost frame is a Java frame, we are (pretty much)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
        // guaranteed to have a viable EBP. We should be more robust
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
        // than this (we have the potential for losing entire threads'
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
        // stack traces) but need to see how much work we really have
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
        // to do here. Searching the stack for an (SP, FP) pair is
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
        // hard since it's easy to misinterpret inter-frame stack
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
        // pointers as base-of-frame pointers; we also don't know the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
        // sizes of C1 frames (not registered in the nmethod) so can't
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
        // derive them from ESP.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
        setValues(sp, fp, pc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
        return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
      } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
        if (vm.getInterpreter().contains(pc)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
          if (DEBUG) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
            System.out.println("CurrentFrameGuess: choosing interpreter frame: sp = " +
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
                               sp + ", fp = " + fp + ", pc = " + pc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
          }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
          setValues(sp, fp, pc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
          return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
        // For the server compiler, EBP is not guaranteed to be valid
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
        // for compiled code. In addition, an earlier attempt at a
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
        // non-searching algorithm (see below) failed because the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
        // stack pointer from the thread context was pointing
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
        // (considerably) beyond the ostensible end of the stack, into
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
        // garbage; walking from the topmost frame back caused a crash.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
        //
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
        // This algorithm takes the current PC as a given and tries to
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
        // find the correct corresponding SP by walking up the stack
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
        // and repeatedly performing stackwalks (very inefficient).
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
        //
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
        // FIXME: there is something wrong with stackwalking across
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
        // adapter frames...this is likely to be the root cause of the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
        // failure with the simpler algorithm below.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
        for (long offset = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
             offset < regionInBytesToSearch;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
             offset += vm.getAddressSize()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
          try {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
            Address curSP = sp.addOffsetTo(offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
            Frame frame = new X86Frame(curSP, null, pc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
            RegisterMap map = thread.newRegisterMap(false);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
            while (frame != null) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
              if (frame.isEntryFrame() && frame.entryFrameIsFirst()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
                // We were able to traverse all the way to the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
                // bottommost Java frame.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
                // This sp looks good. Keep it.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
                if (DEBUG) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
                  System.out.println("CurrentFrameGuess: Choosing sp = " + curSP + ", pc = " + pc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
                }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
                setValues(curSP, null, pc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
                return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
              }
59065
5f458adec06b 8231635: SA Stackwalking code stuck in BasicTypeDataBase.findDynamicTypeForAddress()
cjplummer
parents: 47216
diff changeset
   140
              Frame oldFrame = frame;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
              frame = frame.sender(map);
59065
5f458adec06b 8231635: SA Stackwalking code stuck in BasicTypeDataBase.findDynamicTypeForAddress()
cjplummer
parents: 47216
diff changeset
   142
              if (frame.getSP().lessThanOrEqual(oldFrame.getSP())) {
5f458adec06b 8231635: SA Stackwalking code stuck in BasicTypeDataBase.findDynamicTypeForAddress()
cjplummer
parents: 47216
diff changeset
   143
                  // Frame points to itself or to a location in the wrong direction.
5f458adec06b 8231635: SA Stackwalking code stuck in BasicTypeDataBase.findDynamicTypeForAddress()
cjplummer
parents: 47216
diff changeset
   144
                  // Break the loop and move on to next offset.
5f458adec06b 8231635: SA Stackwalking code stuck in BasicTypeDataBase.findDynamicTypeForAddress()
cjplummer
parents: 47216
diff changeset
   145
                  if (DEBUG) {
5f458adec06b 8231635: SA Stackwalking code stuck in BasicTypeDataBase.findDynamicTypeForAddress()
cjplummer
parents: 47216
diff changeset
   146
                      System.out.println("X86CurrentFrameGuess.run: frame <= oldFrame: " + frame);
5f458adec06b 8231635: SA Stackwalking code stuck in BasicTypeDataBase.findDynamicTypeForAddress()
cjplummer
parents: 47216
diff changeset
   147
                  }
5f458adec06b 8231635: SA Stackwalking code stuck in BasicTypeDataBase.findDynamicTypeForAddress()
cjplummer
parents: 47216
diff changeset
   148
                  break;
5f458adec06b 8231635: SA Stackwalking code stuck in BasicTypeDataBase.findDynamicTypeForAddress()
cjplummer
parents: 47216
diff changeset
   149
              }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
            }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
          } catch (Exception e) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
            if (DEBUG) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
              System.out.println("CurrentFrameGuess: Exception " + e + " at offset " + offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
            }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
            // Bad SP. Try another.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
          }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
        // Were not able to find a plausible SP to go with this PC.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
        // Bail out.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
        return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
        /*
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
        // Original algorithm which does not work because SP was
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
        // pointing beyond where it should have:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
        // For the server compiler, EBP is not guaranteed to be valid
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
        // for compiled code. We see whether the PC is in the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
        // interpreter and take care of that, otherwise we run code
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
        // (unfortunately) duplicated from X86Frame.senderForCompiledFrame.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
        CodeCache cc = vm.getCodeCache();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
        if (cc.contains(pc)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
          CodeBlob cb = cc.findBlob(pc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
          // See if we can derive a frame pointer from SP and PC
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
          // NOTE: This is the code duplicated from X86Frame
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
          Address saved_fp = null;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
          int llink_offset = cb.getLinkOffset();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
          if (llink_offset >= 0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
            // Restore base-pointer, since next frame might be an interpreter frame.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
            Address fp_addr = sp.addOffsetTo(VM.getVM().getAddressSize() * llink_offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
            saved_fp = fp_addr.getAddressAt(0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
          }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
          setValues(sp, saved_fp, pc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
          return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
        */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
      // If the current program counter was not known to us as a Java
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
      // PC, we currently assume that we are in the run-time system
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
      // and attempt to look to thread-local storage for saved ESP and
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
      // EBP. Note that if these are null (because we were, in fact,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
      // in Java code, i.e., vtable stubs or similar, and the SA
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
      // didn't have enough insight into the target VM to understand
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
      // that) then we are going to lose the entire stack trace for
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
      // the thread, which is sub-optimal. FIXME.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
      if (DEBUG) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
        System.out.println("CurrentFrameGuess: choosing last Java frame: sp = " +
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
                           thread.getLastJavaSP() + ", fp = " + thread.getLastJavaFP());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
      if (thread.getLastJavaSP() == null) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
        return false; // No known Java frames on stack
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
      setValues(thread.getLastJavaSP(), thread.getLastJavaFP(), null);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
      return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
  public Address getSP() { return spFound; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
  public Address getFP() { return fpFound; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
  /** May be null if getting values from thread-local storage; take
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
      care to call the correct X86Frame constructor to recover this if
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
      necessary */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
  public Address getPC() { return pcFound; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
  private void setValues(Address sp, Address fp, Address pc) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
    spFound = sp;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
    fpFound = fp;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
    pcFound = pc;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
}