0N/A/*
3441N/A * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1472N/A * or visit www.oracle.com if you need additional information or have any
1472N/A * questions.
0N/A *
0N/A */
0N/A
0N/Apackage sun.jvm.hotspot.debugger.linux.x86;
0N/A
0N/Aimport sun.jvm.hotspot.debugger.*;
0N/Aimport sun.jvm.hotspot.debugger.linux.*;
0N/Aimport sun.jvm.hotspot.debugger.cdbg.*;
0N/Aimport sun.jvm.hotspot.debugger.cdbg.basic.*;
3441N/Aimport sun.jvm.hotspot.debugger.x86.*;
0N/A
0N/Afinal public class LinuxX86CFrame extends BasicCFrame {
0N/A // package/class internals only
0N/A public LinuxX86CFrame(LinuxDebugger dbg, Address ebp, Address pc) {
0N/A super(dbg.getCDebugger());
0N/A this.ebp = ebp;
0N/A this.pc = pc;
0N/A this.dbg = dbg;
0N/A }
0N/A
0N/A // override base class impl to avoid ELF parsing
0N/A public ClosestSymbol closestSymbolToPC() {
0N/A // try native lookup in debugger.
0N/A return dbg.lookup(dbg.getAddressValue(pc()));
0N/A }
0N/A
0N/A public Address pc() {
0N/A return pc;
0N/A }
0N/A
0N/A public Address localVariableBase() {
0N/A return ebp;
0N/A }
0N/A
3441N/A public CFrame sender(ThreadProxy thread) {
3441N/A X86ThreadContext context = (X86ThreadContext) thread.getContext();
3441N/A Address esp = context.getRegisterAsAddress(X86ThreadContext.ESP);
3441N/A
3441N/A if ( (ebp == null) || ebp.lessThan(esp) ) {
0N/A return null;
0N/A }
0N/A
4354N/A // Check alignment of ebp
4354N/A if ( dbg.getAddressValue(ebp) % ADDRESS_SIZE != 0) {
4354N/A return null;
4354N/A }
4354N/A
0N/A Address nextEBP = ebp.getAddressAt( 0 * ADDRESS_SIZE);
4354N/A if (nextEBP == null || nextEBP.lessThanOrEqual(ebp)) {
0N/A return null;
0N/A }
0N/A Address nextPC = ebp.getAddressAt( 1 * ADDRESS_SIZE);
0N/A if (nextPC == null) {
0N/A return null;
0N/A }
0N/A return new LinuxX86CFrame(dbg, nextEBP, nextPC);
0N/A }
0N/A
0N/A private static final int ADDRESS_SIZE = 4;
0N/A private Address pc;
0N/A private Address ebp;
0N/A private LinuxDebugger dbg;
0N/A}