LinuxPPC64CFrame.java revision 9883:903a2e023ffb
133965Sjdp/*
233965Sjdp * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
333965Sjdp * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
433965Sjdp *
533965Sjdp * This code is free software; you can redistribute it and/or modify it
689857Sobrien * under the terms of the GNU General Public License version 2 only, as
733965Sjdp * published by the Free Software Foundation.
889857Sobrien *
989857Sobrien * This code is distributed in the hope that it will be useful, but WITHOUT
1089857Sobrien * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1189857Sobrien * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1289857Sobrien * version 2 for more details (a copy is included in the LICENSE file that
1389857Sobrien * accompanied this code).
1489857Sobrien *
1533965Sjdp * You should have received a copy of the GNU General Public License version
1689857Sobrien * 2 along with this work; if not, write to the Free Software Foundation,
1760484Sobrien * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1833965Sjdp *
1933965Sjdp * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2060484Sobrien * or visit www.oracle.com if you need additional information or have any
2160484Sobrien * questions.
2260484Sobrien *
2333965Sjdp */
2433965Sjdp
2533965Sjdppackage sun.jvm.hotspot.debugger.linux.ppc64;
2677298Sobrien
2777298Sobrienimport sun.jvm.hotspot.debugger.*;
2877298Sobrienimport sun.jvm.hotspot.debugger.ppc64.*;
2977298Sobrienimport sun.jvm.hotspot.debugger.linux.*;
3077298Sobrienimport sun.jvm.hotspot.debugger.cdbg.*;
3177298Sobrienimport sun.jvm.hotspot.debugger.cdbg.basic.*;
3233965Sjdp
3333965Sjdpfinal public class LinuxPPC64CFrame extends BasicCFrame {
3433965Sjdp  // package/class internals only
3533965Sjdp
3633965Sjdp  public LinuxPPC64CFrame(LinuxDebugger dbg, Address sp, Address pc, int address_size) {
3733965Sjdp    super(dbg.getCDebugger());
3833965Sjdp    this.sp = sp;
3933965Sjdp    this.pc = pc;
4033965Sjdp    this.dbg = dbg;
41218822Sdim    this.address_size = address_size;
4233965Sjdp  }
4333965Sjdp
4433965Sjdp  // override base class impl to avoid ELF parsing
4533965Sjdp  public ClosestSymbol closestSymbolToPC() {
4633965Sjdp    // try native lookup in debugger.
4733965Sjdp    return dbg.lookup(dbg.getAddressValue(pc()));
4833965Sjdp  }
4933965Sjdp
5033965Sjdp  public Address pc() {
5133965Sjdp    return pc;
5260484Sobrien  }
5360484Sobrien
5460484Sobrien  public Address localVariableBase() {
5560484Sobrien    return sp;
5660484Sobrien  }
5760484Sobrien
5860484Sobrien  public CFrame sender(ThreadProxy thread) {
5933965Sjdp    if (sp == null) {
6033965Sjdp      return null;
6133965Sjdp    }
6233965Sjdp
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