1/*
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25package sun.jvm.hotspot.debugger.linux.ppc64;
26
27import sun.jvm.hotspot.debugger.*;
28import sun.jvm.hotspot.debugger.ppc64.*;
29import sun.jvm.hotspot.debugger.linux.*;
30import sun.jvm.hotspot.debugger.cdbg.*;
31import sun.jvm.hotspot.debugger.cdbg.basic.*;
32
33final public class LinuxPPC64CFrame extends BasicCFrame {
34  // package/class internals only
35
36  public LinuxPPC64CFrame(LinuxDebugger dbg, Address sp, Address pc, int address_size) {
37    super(dbg.getCDebugger());
38    this.sp = sp;
39    this.pc = pc;
40    this.dbg = dbg;
41    this.address_size = address_size;
42  }
43
44  // override base class impl to avoid ELF parsing
45  public ClosestSymbol closestSymbolToPC() {
46    // try native lookup in debugger.
47    return dbg.lookup(dbg.getAddressValue(pc()));
48  }
49
50  public Address pc() {
51    return pc;
52  }
53
54  public Address localVariableBase() {
55    return sp;
56  }
57
58  public CFrame sender(ThreadProxy thread) {
59    if (sp == null) {
60      return null;
61    }
62
63    Address nextSP = sp.getAddressAt(0);
64    if (nextSP == null) {
65      return null;
66    }
67    Address nextPC  = sp.getAddressAt(2 * address_size);
68    if (nextPC == null) {
69      return null;
70    }
71    return new LinuxPPC64CFrame(dbg, nextSP, nextPC, address_size);
72  }
73
74  public static int PPC64_STACK_BIAS = 0;
75  private static int address_size;
76  private Address pc;
77  private Address sp;
78  private LinuxDebugger dbg;
79}
80