8282410: Remove SA ProcDebugger support

Reviewed-by: kevinw, amenkov
This commit is contained in:
Chris Plummer 2022-08-25 22:25:49 +00:00
parent d83faeaf9a
commit 55f5a83b88
23 changed files with 2 additions and 1655 deletions

@ -1,393 +0,0 @@
/*
* Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
package sun.jvm.hotspot.debugger.proc;
import sun.jvm.hotspot.debugger.*;
class ProcAddress implements Address {
protected ProcDebugger debugger;
protected long addr;
ProcAddress(ProcDebugger debugger, long addr) {
this.debugger = debugger;
this.addr = addr;
}
//
// Basic Java routines
//
public boolean equals(Object arg) {
if (arg == null) {
return false;
}
if (!(arg instanceof ProcAddress)) {
return false;
}
return (addr == ((ProcAddress) arg).addr);
}
public int hashCode() {
return Long.hashCode(addr);
}
public String toString() {
return debugger.addressValueToString(addr);
}
//
// C/C++-related routines
//
public long getCIntegerAt(long offset, long numBytes, boolean isUnsigned) throws UnalignedAddressException, UnmappedAddressException {
return debugger.readCInteger(addr + offset, numBytes, isUnsigned);
}
public Address getAddressAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
return debugger.readAddress(addr + offset);
}
public Address getCompOopAddressAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
return debugger.readCompOopAddress(addr + offset);
}
public Address getCompKlassAddressAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
return debugger.readCompKlassAddress(addr + offset);
}
//
// Java-related routines
//
public boolean getJBooleanAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
return debugger.readJBoolean(addr + offset);
}
public byte getJByteAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
return debugger.readJByte(addr + offset);
}
public char getJCharAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
return debugger.readJChar(addr + offset);
}
public double getJDoubleAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
return debugger.readJDouble(addr + offset);
}
public float getJFloatAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
return debugger.readJFloat(addr + offset);
}
public int getJIntAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
return debugger.readJInt(addr + offset);
}
public long getJLongAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
return debugger.readJLong(addr + offset);
}
public short getJShortAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
return debugger.readJShort(addr + offset);
}
public OopHandle getOopHandleAt(long offset)
throws UnalignedAddressException, UnmappedAddressException, NotInHeapException {
return debugger.readOopHandle(addr + offset);
}
public OopHandle getCompOopHandleAt(long offset)
throws UnalignedAddressException, UnmappedAddressException, NotInHeapException {
return debugger.readCompOopHandle(addr + offset);
}
// Mutators -- not implemented for now (FIXME)
public void setCIntegerAt(long offset, long numBytes, long value) {
throw new DebuggerException("Unimplemented");
}
public void setAddressAt(long offset, Address value) {
throw new DebuggerException("Unimplemented");
}
public void setJBooleanAt (long offset, boolean value)
throws UnmappedAddressException, UnalignedAddressException {
throw new DebuggerException("Unimplemented");
}
public void setJByteAt (long offset, byte value)
throws UnmappedAddressException, UnalignedAddressException {
throw new DebuggerException("Unimplemented");
}
public void setJCharAt (long offset, char value)
throws UnmappedAddressException, UnalignedAddressException {
throw new DebuggerException("Unimplemented");
}
public void setJDoubleAt (long offset, double value)
throws UnmappedAddressException, UnalignedAddressException {
throw new DebuggerException("Unimplemented");
}
public void setJFloatAt (long offset, float value)
throws UnmappedAddressException, UnalignedAddressException {
throw new DebuggerException("Unimplemented");
}
public void setJIntAt (long offset, int value)
throws UnmappedAddressException, UnalignedAddressException {
throw new DebuggerException("Unimplemented");
}
public void setJLongAt (long offset, long value)
throws UnmappedAddressException, UnalignedAddressException {
throw new DebuggerException("Unimplemented");
}
public void setJShortAt (long offset, short value)
throws UnmappedAddressException, UnalignedAddressException {
throw new DebuggerException("Unimplemented");
}
public void setOopHandleAt (long offset, OopHandle value)
throws UnmappedAddressException, UnalignedAddressException {
throw new DebuggerException("Unimplemented");
}
//
// Arithmetic operations -- necessary evil.
//
public Address addOffsetTo (long offset) throws UnsupportedOperationException {
long value = addr + offset;
if (value == 0) {
return null;
}
return new ProcAddress(debugger, value);
}
public OopHandle addOffsetToAsOopHandle(long offset) throws UnsupportedOperationException {
long value = addr + offset;
if (value == 0) {
return null;
}
return new ProcOopHandle(debugger, value);
}
/** (FIXME: any signed/unsigned issues? Should this work for
OopHandles?) */
public long minus(Address arg) {
if (arg == null) {
return addr;
}
return addr - ((ProcAddress) arg).addr;
}
// Two's complement representation.
// All negative numbers are larger than positive numbers.
// Numbers with the same sign can be compared normally.
// Test harness is below in main().
public boolean lessThan (Address arg) {
if (arg == null) {
return false;
}
ProcAddress dbxArg = (ProcAddress) arg;
if ((addr >= 0) && (dbxArg.addr < 0)) {
return true;
}
if ((addr < 0) && (dbxArg.addr >= 0)) {
return false;
}
return (addr < dbxArg.addr);
}
public boolean lessThanOrEqual (Address arg) {
if (arg == null) {
return false;
}
ProcAddress dbxArg = (ProcAddress) arg;
if ((addr >= 0) && (dbxArg.addr < 0)) {
return true;
}
if ((addr < 0) && (dbxArg.addr >= 0)) {
return false;
}
return (addr <= dbxArg.addr);
}
public boolean greaterThan (Address arg) {
if (arg == null) {
return true;
}
ProcAddress dbxArg = (ProcAddress) arg;
if ((addr >= 0) && (dbxArg.addr < 0)) {
return false;
}
if ((addr < 0) && (dbxArg.addr >= 0)) {
return true;
}
return (addr > dbxArg.addr);
}
public boolean greaterThanOrEqual(Address arg) {
if (arg == null) {
return true;
}
ProcAddress dbxArg = (ProcAddress) arg;
if ((addr >= 0) && (dbxArg.addr < 0)) {
return false;
}
if ((addr < 0) && (dbxArg.addr >= 0)) {
return true;
}
return (addr >= dbxArg.addr);
}
public Address andWithMask(long mask) throws UnsupportedOperationException {
long value = addr & mask;
if (value == 0) {
return null;
}
return new ProcAddress(debugger, value);
}
public Address orWithMask(long mask) throws UnsupportedOperationException {
long value = addr | mask;
if (value == 0) {
return null;
}
return new ProcAddress(debugger, value);
}
public Address xorWithMask(long mask) throws UnsupportedOperationException {
long value = addr ^ mask;
if (value == 0) {
return null;
}
return new ProcAddress(debugger, value);
}
public long asLongValue() { return addr; }
//--------------------------------------------------------------------------------
// Internals only below this point
//
private static void check(boolean arg, String failMessage) {
if (!arg) {
System.err.println(failMessage + ": FAILED");
System.exit(1);
}
}
// Test harness
public static void main(String[] args) {
// p/n indicates whether the interior address is really positive
// or negative. In unsigned terms, p1 < p2 < n1 < n2.
ProcAddress p1 = new ProcAddress(null, 0x7FFFFFFFFFFFFFF0L);
ProcAddress p2 = (ProcAddress) p1.addOffsetTo(10);
ProcAddress n1 = (ProcAddress) p2.addOffsetTo(10);
ProcAddress n2 = (ProcAddress) n1.addOffsetTo(10);
// lessThan positive tests
check(p1.lessThan(p2), "lessThan 1");
check(p1.lessThan(n1), "lessThan 2");
check(p1.lessThan(n2), "lessThan 3");
check(p2.lessThan(n1), "lessThan 4");
check(p2.lessThan(n2), "lessThan 5");
check(n1.lessThan(n2), "lessThan 6");
// lessThan negative tests
check(!p1.lessThan(p1), "lessThan 7");
check(!p2.lessThan(p2), "lessThan 8");
check(!n1.lessThan(n1), "lessThan 9");
check(!n2.lessThan(n2), "lessThan 10");
check(!p2.lessThan(p1), "lessThan 11");
check(!n1.lessThan(p1), "lessThan 12");
check(!n2.lessThan(p1), "lessThan 13");
check(!n1.lessThan(p2), "lessThan 14");
check(!n2.lessThan(p2), "lessThan 15");
check(!n2.lessThan(n1), "lessThan 16");
// lessThanOrEqual positive tests
check(p1.lessThanOrEqual(p1), "lessThanOrEqual 1");
check(p2.lessThanOrEqual(p2), "lessThanOrEqual 2");
check(n1.lessThanOrEqual(n1), "lessThanOrEqual 3");
check(n2.lessThanOrEqual(n2), "lessThanOrEqual 4");
check(p1.lessThanOrEqual(p2), "lessThanOrEqual 5");
check(p1.lessThanOrEqual(n1), "lessThanOrEqual 6");
check(p1.lessThanOrEqual(n2), "lessThanOrEqual 7");
check(p2.lessThanOrEqual(n1), "lessThanOrEqual 8");
check(p2.lessThanOrEqual(n2), "lessThanOrEqual 9");
check(n1.lessThanOrEqual(n2), "lessThanOrEqual 10");
// lessThanOrEqual negative tests
check(!p2.lessThanOrEqual(p1), "lessThanOrEqual 11");
check(!n1.lessThanOrEqual(p1), "lessThanOrEqual 12");
check(!n2.lessThanOrEqual(p1), "lessThanOrEqual 13");
check(!n1.lessThanOrEqual(p2), "lessThanOrEqual 14");
check(!n2.lessThanOrEqual(p2), "lessThanOrEqual 15");
check(!n2.lessThanOrEqual(n1), "lessThanOrEqual 16");
// greaterThan positive tests
check(n2.greaterThan(p1), "greaterThan 1");
check(n2.greaterThan(p2), "greaterThan 2");
check(n2.greaterThan(n1), "greaterThan 3");
check(n1.greaterThan(p1), "greaterThan 4");
check(n1.greaterThan(p2), "greaterThan 5");
check(p2.greaterThan(p1), "greaterThan 6");
// greaterThan negative tests
check(!p1.greaterThan(p1), "greaterThan 7");
check(!p2.greaterThan(p2), "greaterThan 8");
check(!n1.greaterThan(n1), "greaterThan 9");
check(!n2.greaterThan(n2), "greaterThan 10");
check(!p1.greaterThan(n2), "greaterThan 11");
check(!p2.greaterThan(n2), "greaterThan 12");
check(!n1.greaterThan(n2), "greaterThan 13");
check(!p1.greaterThan(n1), "greaterThan 14");
check(!p2.greaterThan(n1), "greaterThan 15");
check(!p1.greaterThan(p2), "greaterThan 16");
// greaterThanOrEqual positive tests
check(p1.greaterThanOrEqual(p1), "greaterThanOrEqual 1");
check(p2.greaterThanOrEqual(p2), "greaterThanOrEqual 2");
check(n1.greaterThanOrEqual(n1), "greaterThanOrEqual 3");
check(n2.greaterThanOrEqual(n2), "greaterThanOrEqual 4");
check(n2.greaterThanOrEqual(p1), "greaterThanOrEqual 5");
check(n2.greaterThanOrEqual(p2), "greaterThanOrEqual 6");
check(n2.greaterThanOrEqual(n1), "greaterThanOrEqual 7");
check(n1.greaterThanOrEqual(p1), "greaterThanOrEqual 8");
check(n1.greaterThanOrEqual(p2), "greaterThanOrEqual 9");
check(p2.greaterThanOrEqual(p1), "greaterThanOrEqual 10");
// greaterThanOrEqual negative tests
check(!p1.greaterThanOrEqual(n2), "greaterThanOrEqual 11");
check(!p2.greaterThanOrEqual(n2), "greaterThanOrEqual 12");
check(!n1.greaterThanOrEqual(n2), "greaterThanOrEqual 13");
check(!p1.greaterThanOrEqual(n1), "greaterThanOrEqual 14");
check(!p2.greaterThanOrEqual(n1), "greaterThanOrEqual 15");
check(!p1.greaterThanOrEqual(p2), "greaterThanOrEqual 16");
System.err.println("ProcAddress: all tests passed successfully.");
}
}

@ -1,101 +0,0 @@
/*
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
package sun.jvm.hotspot.debugger.proc;
import java.io.*;
import java.util.*;
import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.debugger.cdbg.*;
import sun.jvm.hotspot.utilities.*;
class ProcCDebugger implements CDebugger {
private ProcDebugger dbg;
ProcCDebugger(ProcDebugger dbg) {
this.dbg = dbg;
}
public List<ThreadProxy> getThreadList() throws DebuggerException {
return dbg.getThreadList();
}
public List<LoadObject> getLoadObjectList() throws DebuggerException {
return dbg.getLoadObjectList();
}
public LoadObject loadObjectContainingPC(Address pc) throws DebuggerException {
if (pc == null) {
return null;
}
List<LoadObject> objs = getLoadObjectList();
Object[] arr = objs.toArray();
// load objects are sorted by base address, do binary search
int mid = -1;
int low = 0;
int high = arr.length - 1;
while (low <= high) {
mid = (low + high) >> 1;
LoadObject midVal = (LoadObject) arr[mid];
long cmp = pc.minus(midVal.getBase());
if (cmp < 0) {
high = mid - 1;
} else if (cmp > 0) {
long size = midVal.getSize();
if (cmp >= size) {
low = mid + 1;
} else {
return (LoadObject) arr[mid];
}
} else { // match found
return (LoadObject) arr[mid];
}
}
// no match found.
return null;
}
public CFrame topFrameForThread(ThreadProxy thread) throws DebuggerException {
return dbg.topFrameForThread(thread);
}
public String getNameOfFile(String fileName) {
return new File(fileName).getName();
}
public ProcessControl getProcessControl() throws DebuggerException {
// FIXME: after stabs parser
return null;
}
// C++ name demangling
public boolean canDemangle() {
return true;
}
public String demangle(String sym) {
return dbg.demangle(sym);
}
}

@ -1,67 +0,0 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
package sun.jvm.hotspot.debugger.proc;
import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.debugger.cdbg.*;
import sun.jvm.hotspot.debugger.cdbg.basic.*;
final class ProcCFrame extends BasicCFrame {
public Address pc() {
return pc;
}
public Address localVariableBase() {
return fp;
}
public CFrame sender(ThreadProxy t) {
return sender;
}
public ClosestSymbol closestSymbolToPC() {
// we don't use base class ELF parsing based
// symbol lookup for pc for performance reasons.
return procDbg.lookup(procDbg.getAddressValue(pc));
}
// package/class internals only
ProcCFrame(ProcDebugger dbg, Address pc, Address fp) {
super(dbg.getCDebugger());
this.pc = pc;
this.fp = fp;
this.procDbg = dbg;
}
void setSender(ProcCFrame sender) {
this.sender = sender;
}
private Address pc;
private Address fp;
private ProcCFrame sender;
private ProcDebugger procDbg;
}

@ -1,62 +0,0 @@
/*
* Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
package sun.jvm.hotspot.debugger.proc;
import java.util.List;
import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.debugger.cdbg.*;
/** An extension of the JVMDebugger interface with a few additions to
support 32-bit vs. 64-bit debugging as well as features required
by the architecture-specific subpackages. */
public interface ProcDebugger extends JVMDebugger {
public MachineDescription getMachineDescription() throws DebuggerException;
public String addressValueToString(long address) throws DebuggerException;
public boolean readJBoolean(long address) throws DebuggerException;
public byte readJByte(long address) throws DebuggerException;
public char readJChar(long address) throws DebuggerException;
public double readJDouble(long address) throws DebuggerException;
public float readJFloat(long address) throws DebuggerException;
public int readJInt(long address) throws DebuggerException;
public long readJLong(long address) throws DebuggerException;
public short readJShort(long address) throws DebuggerException;
public long readCInteger(long address, long numBytes, boolean isUnsigned)
throws DebuggerException;
public ProcAddress readAddress(long address) throws DebuggerException;
public ProcAddress readCompOopAddress(long address) throws DebuggerException;
public ProcAddress readCompKlassAddress(long address) throws DebuggerException;
public ProcOopHandle readOopHandle(long address) throws DebuggerException;
public ProcOopHandle readCompOopHandle(long address) throws DebuggerException;
public long[] getThreadIntegerRegisterSet(int tid) throws DebuggerException;
public long getAddressValue(Address addr) throws DebuggerException;
// for ProcCDebugger, ProcCFrame and SharedObject
public List<ThreadProxy> getThreadList() throws DebuggerException;
public List<LoadObject> getLoadObjectList() throws DebuggerException;
public CFrame topFrameForThread(ThreadProxy thread) throws DebuggerException;
public ClosestSymbol lookup(long address) throws DebuggerException;
public String demangle(String name);
}

@ -1,49 +0,0 @@
/*
* Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
package sun.jvm.hotspot.debugger.proc;
import sun.jvm.hotspot.debugger.*;
class ProcOopHandle extends ProcAddress implements OopHandle {
ProcOopHandle(ProcDebugger debugger, long addr) {
super(debugger, addr);
}
public Address addOffsetTo (long offset) throws UnsupportedOperationException {
throw new UnsupportedOperationException("addOffsetTo not applicable to OopHandles (interior object pointers not allowed)");
}
public Address andWithMask(long mask) throws UnsupportedOperationException {
throw new UnsupportedOperationException("andWithMask not applicable to OopHandles (i.e., anything but C addresses)");
}
public Address orWithMask(long mask) throws UnsupportedOperationException {
throw new UnsupportedOperationException("orWithMask not applicable to OopHandles (i.e., anything but C addresses)");
}
public Address xorWithMask(long mask) throws UnsupportedOperationException {
throw new UnsupportedOperationException("xorWithMask not applicable to OopHandles (i.e., anything but C addresses)");
}
}

@ -1,35 +0,0 @@
/*
* Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
package sun.jvm.hotspot.debugger.proc;
import sun.jvm.hotspot.debugger.*;
/** An interface used only internally by the ProcDebugger to be able to
create platform-specific Thread objects */
public interface ProcThreadFactory {
public ThreadProxy createThreadWrapper(Address threadIdentifierAddr);
public ThreadProxy createThreadWrapper(long id);
}

@ -1,52 +0,0 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
package sun.jvm.hotspot.debugger.proc;
import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.debugger.cdbg.*;
import sun.jvm.hotspot.debugger.posix.*;
/** An Object can represent either a .so or an a.out file. */
class SharedObject extends DSO {
SharedObject(ProcDebugger dbg, String filename, long size, Address relocation) {
super(filename, size, relocation);
this.dbg = dbg;
}
protected Address newAddress(long address) {
return dbg.newAddress(address);
}
protected long getAddressValue(Address addr) {
return dbg.getAddressValue(addr);
}
public ClosestSymbol closestSymbolToPC(Address pcAsAddr) throws DebuggerException {
return dbg.lookup(dbg.getAddressValue(pcAsAddr));
}
private ProcDebugger dbg;
}

@ -1,87 +0,0 @@
/*
* Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, Red Hat Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
package sun.jvm.hotspot.debugger.proc.aarch64;
import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.debugger.aarch64.*;
import sun.jvm.hotspot.debugger.proc.*;
import sun.jvm.hotspot.utilities.*;
public class ProcAARCH64Thread implements ThreadProxy {
private ProcDebugger debugger;
private int id;
public ProcAARCH64Thread(ProcDebugger debugger, Address addr) {
this.debugger = debugger;
// FIXME: the size here should be configurable. However, making it
// so would produce a dependency on the "types" package from the
// debugger package, which is not desired.
this.id = (int) addr.getCIntegerAt(0, 4, true);
}
public ProcAARCH64Thread(ProcDebugger debugger, long id) {
this.debugger = debugger;
this.id = (int) id;
}
public ThreadContext getContext() throws IllegalThreadStateException {
ProcAARCH64ThreadContext context = new ProcAARCH64ThreadContext(debugger);
long[] regs = debugger.getThreadIntegerRegisterSet(id);
if (Assert.ASSERTS_ENABLED) {
Assert.that(regs.length == AARCH64ThreadContext.NPRGREG, "size mismatch");
}
for (int i = 0; i < regs.length; i++) {
context.setRegister(i, regs[i]);
}
return context;
}
public boolean canSetContext() throws DebuggerException {
return false;
}
public void setContext(ThreadContext context)
throws IllegalThreadStateException, DebuggerException {
throw new DebuggerException("Unimplemented");
}
public String toString() {
return "t@" + id;
}
public boolean equals(Object obj) {
if (!(obj instanceof ProcAARCH64Thread other)) {
return false;
}
return (other.id == id);
}
public int hashCode() {
return id;
}
}

@ -1,47 +0,0 @@
/*
* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, Red Hat Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
package sun.jvm.hotspot.debugger.proc.aarch64;
import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.debugger.aarch64.*;
import sun.jvm.hotspot.debugger.proc.*;
public class ProcAARCH64ThreadContext extends AARCH64ThreadContext {
private ProcDebugger debugger;
public ProcAARCH64ThreadContext(ProcDebugger debugger) {
super();
this.debugger = debugger;
}
public void setRegisterAsAddress(int index, Address value) {
setRegister(index, debugger.getAddressValue(value));
}
public Address getRegisterAsAddress(int index) {
return debugger.newAddress(getRegister(index));
}
}

@ -1,45 +0,0 @@
/*
* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, Red Hat Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
package sun.jvm.hotspot.debugger.proc.aarch64;
import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.debugger.proc.*;
public class ProcAARCH64ThreadFactory implements ProcThreadFactory {
private ProcDebugger debugger;
public ProcAARCH64ThreadFactory(ProcDebugger debugger) {
this.debugger = debugger;
}
public ThreadProxy createThreadWrapper(Address threadIdentifierAddr) {
return new ProcAARCH64Thread(debugger, threadIdentifierAddr);
}
public ThreadProxy createThreadWrapper(long id) {
return new ProcAARCH64Thread(debugger, id);
}
}

@ -1,86 +0,0 @@
/*
* Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
package sun.jvm.hotspot.debugger.proc.amd64;
import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.debugger.amd64.*;
import sun.jvm.hotspot.debugger.proc.*;
import sun.jvm.hotspot.utilities.*;
public class ProcAMD64Thread implements ThreadProxy {
private ProcDebugger debugger;
private int id;
public ProcAMD64Thread(ProcDebugger debugger, Address addr) {
this.debugger = debugger;
// FIXME: the size here should be configurable. However, making it
// so would produce a dependency on the "types" package from the
// debugger package, which is not desired.
this.id = (int) addr.getCIntegerAt(0, 4, true);
}
public ProcAMD64Thread(ProcDebugger debugger, long id) {
this.debugger = debugger;
this.id = (int) id;
}
public ThreadContext getContext() throws IllegalThreadStateException {
ProcAMD64ThreadContext context = new ProcAMD64ThreadContext(debugger);
long[] regs = debugger.getThreadIntegerRegisterSet(id);
if (Assert.ASSERTS_ENABLED) {
Assert.that(regs.length == AMD64ThreadContext.NPRGREG, "size mismatch");
}
for (int i = 0; i < regs.length; i++) {
context.setRegister(i, regs[i]);
}
return context;
}
public boolean canSetContext() throws DebuggerException {
return false;
}
public void setContext(ThreadContext context)
throws IllegalThreadStateException, DebuggerException {
throw new DebuggerException("Unimplemented");
}
public String toString() {
return "t@" + id;
}
public boolean equals(Object obj) {
if (!(obj instanceof ProcAMD64Thread other)) {
return false;
}
return (other.id == id);
}
public int hashCode() {
return id;
}
}

@ -1,46 +0,0 @@
/*
* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
package sun.jvm.hotspot.debugger.proc.amd64;
import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.debugger.amd64.*;
import sun.jvm.hotspot.debugger.proc.*;
public class ProcAMD64ThreadContext extends AMD64ThreadContext {
private ProcDebugger debugger;
public ProcAMD64ThreadContext(ProcDebugger debugger) {
super();
this.debugger = debugger;
}
public void setRegisterAsAddress(int index, Address value) {
setRegister(index, debugger.getAddressValue(value));
}
public Address getRegisterAsAddress(int index) {
return debugger.newAddress(getRegister(index));
}
}

@ -1,44 +0,0 @@
/*
* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
package sun.jvm.hotspot.debugger.proc.amd64;
import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.debugger.proc.*;
public class ProcAMD64ThreadFactory implements ProcThreadFactory {
private ProcDebugger debugger;
public ProcAMD64ThreadFactory(ProcDebugger debugger) {
this.debugger = debugger;
}
public ThreadProxy createThreadWrapper(Address threadIdentifierAddr) {
return new ProcAMD64Thread(debugger, threadIdentifierAddr);
}
public ThreadProxy createThreadWrapper(long id) {
return new ProcAMD64Thread(debugger, id);
}
}

@ -1,86 +0,0 @@
/*
* Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
package sun.jvm.hotspot.debugger.proc.ppc64;
import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.debugger.ppc64.*;
import sun.jvm.hotspot.debugger.proc.*;
import sun.jvm.hotspot.utilities.*;
public class ProcPPC64Thread implements ThreadProxy {
private ProcDebugger debugger;
private int id;
public ProcPPC64Thread(ProcDebugger debugger, Address addr) {
this.debugger = debugger;
// FIXME: the size here should be configurable. However, making it
// so would produce a dependency on the "types" package from the
// debugger package, which is not desired.
this.id = (int) addr.getCIntegerAt(0, 4, true);
}
public ProcPPC64Thread(ProcDebugger debugger, long id) {
this.debugger = debugger;
this.id = (int) id;
}
public ThreadContext getContext() throws IllegalThreadStateException {
ProcPPC64ThreadContext context = new ProcPPC64ThreadContext(debugger);
long[] regs = debugger.getThreadIntegerRegisterSet(id);
if (Assert.ASSERTS_ENABLED) {
Assert.that(regs.length <= PPC64ThreadContext.NPRGREG, "size of register set is greater than " + PPC64ThreadContext.NPRGREG);
}
for (int i = 0; i < regs.length; i++) {
context.setRegister(i, regs[i]);
}
return context;
}
public boolean canSetContext() throws DebuggerException {
return false;
}
public void setContext(ThreadContext context)
throws IllegalThreadStateException, DebuggerException {
throw new DebuggerException("Unimplemented");
}
public String toString() {
return "t@" + id;
}
public boolean equals(Object obj) {
if (!(obj instanceof ProcPPC64Thread other)) {
return false;
}
return (other.id == id);
}
public int hashCode() {
return id;
}
}

@ -1,46 +0,0 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
package sun.jvm.hotspot.debugger.proc.ppc64;
import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.debugger.ppc64.*;
import sun.jvm.hotspot.debugger.proc.*;
public class ProcPPC64ThreadContext extends PPC64ThreadContext {
private ProcDebugger debugger;
public ProcPPC64ThreadContext(ProcDebugger debugger) {
super();
this.debugger = debugger;
}
public void setRegisterAsAddress(int index, Address value) {
setRegister(index, debugger.getAddressValue(value));
}
public Address getRegisterAsAddress(int index) {
return debugger.newAddress(getRegister(index));
}
}

@ -1,44 +0,0 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
package sun.jvm.hotspot.debugger.proc.ppc64;
import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.debugger.proc.*;
public class ProcPPC64ThreadFactory implements ProcThreadFactory {
private ProcDebugger debugger;
public ProcPPC64ThreadFactory(ProcDebugger debugger) {
this.debugger = debugger;
}
public ThreadProxy createThreadWrapper(Address threadIdentifierAddr) {
return new ProcPPC64Thread(debugger, threadIdentifierAddr);
}
public ThreadProxy createThreadWrapper(long id) {
return new ProcPPC64Thread(debugger, id);
}
}

@ -1,88 +0,0 @@
/*
* Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, Red Hat Inc.
* Copyright (c) 2021, Huawei Technologies Co., Ltd. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
package sun.jvm.hotspot.debugger.proc.riscv64;
import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.debugger.riscv64.*;
import sun.jvm.hotspot.debugger.proc.*;
import sun.jvm.hotspot.utilities.*;
public class ProcRISCV64Thread implements ThreadProxy {
private ProcDebugger debugger;
private int id;
public ProcRISCV64Thread(ProcDebugger debugger, Address addr) {
this.debugger = debugger;
// FIXME: the size here should be configurable. However, making it
// so would produce a dependency on the "types" package from the
// debugger package, which is not desired.
this.id = (int) addr.getCIntegerAt(0, 4, true);
}
public ProcRISCV64Thread(ProcDebugger debugger, long id) {
this.debugger = debugger;
this.id = (int) id;
}
public ThreadContext getContext() throws IllegalThreadStateException {
ProcRISCV64ThreadContext context = new ProcRISCV64ThreadContext(debugger);
long[] regs = debugger.getThreadIntegerRegisterSet(id);
if (Assert.ASSERTS_ENABLED) {
Assert.that(regs.length == RISCV64ThreadContext.NPRGREG, "size mismatch");
}
for (int i = 0; i < regs.length; i++) {
context.setRegister(i, regs[i]);
}
return context;
}
public boolean canSetContext() throws DebuggerException {
return false;
}
public void setContext(ThreadContext context)
throws IllegalThreadStateException, DebuggerException {
throw new DebuggerException("Unimplemented");
}
public String toString() {
return "t@" + id;
}
public boolean equals(Object obj) {
if (!(obj instanceof ProcRISCV64Thread other)) {
return false;
}
return (other.id == id);
}
public int hashCode() {
return id;
}
}

@ -1,48 +0,0 @@
/*
* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, Red Hat Inc.
* Copyright (c) 2021, Huawei Technologies Co., Ltd. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
package sun.jvm.hotspot.debugger.proc.riscv64;
import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.debugger.riscv64.*;
import sun.jvm.hotspot.debugger.proc.*;
public class ProcRISCV64ThreadContext extends RISCV64ThreadContext {
private ProcDebugger debugger;
public ProcRISCV64ThreadContext(ProcDebugger debugger) {
super();
this.debugger = debugger;
}
public void setRegisterAsAddress(int index, Address value) {
setRegister(index, debugger.getAddressValue(value));
}
public Address getRegisterAsAddress(int index) {
return debugger.newAddress(getRegister(index));
}
}

@ -1,46 +0,0 @@
/*
* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, Red Hat Inc.
* Copyright (c) 2021, Huawei Technologies Co., Ltd. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
package sun.jvm.hotspot.debugger.proc.riscv64;
import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.debugger.proc.*;
public class ProcRISCV64ThreadFactory implements ProcThreadFactory {
private ProcDebugger debugger;
public ProcRISCV64ThreadFactory(ProcDebugger debugger) {
this.debugger = debugger;
}
public ThreadProxy createThreadWrapper(Address threadIdentifierAddr) {
return new ProcRISCV64Thread(debugger, threadIdentifierAddr);
}
public ThreadProxy createThreadWrapper(long id) {
return new ProcRISCV64Thread(debugger, id);
}
}

@ -1,91 +0,0 @@
/*
* Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
package sun.jvm.hotspot.debugger.proc.x86;
import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.debugger.x86.*;
import sun.jvm.hotspot.debugger.proc.*;
import sun.jvm.hotspot.utilities.*;
public class ProcX86Thread implements ThreadProxy {
private ProcDebugger debugger;
private int id;
public ProcX86Thread(ProcDebugger debugger, Address addr) {
this.debugger = debugger;
// FIXME: the size here should be configurable. However, making it
// so would produce a dependency on the "types" package from the
// debugger package, which is not desired.
this.id = (int) addr.getCIntegerAt(0, 4, true);
}
public ProcX86Thread(ProcDebugger debugger, long id) {
this.debugger = debugger;
this.id = (int) id;
}
public ThreadContext getContext() throws IllegalThreadStateException {
ProcX86ThreadContext context = new ProcX86ThreadContext(debugger);
long[] regs = debugger.getThreadIntegerRegisterSet(id);
/*
_NGREG in reg.h is defined to be 19. Because we have included
debug registers X86ThreadContext.NPRGREG is 25.
*/
if (Assert.ASSERTS_ENABLED) {
Assert.that(regs.length <= X86ThreadContext.NPRGREG, "size of register set is greater than " + X86ThreadContext.NPRGREG);
}
for (int i = 0; i < regs.length; i++) {
context.setRegister(i, regs[i]);
}
return context;
}
public boolean canSetContext() throws DebuggerException {
return false;
}
public void setContext(ThreadContext context)
throws IllegalThreadStateException, DebuggerException {
throw new DebuggerException("Unimplemented");
}
public String toString() {
return "t@" + id;
}
public boolean equals(Object obj) {
if (!(obj instanceof ProcX86Thread other)) {
return false;
}
return (other.id == id);
}
public int hashCode() {
return id;
}
}

@ -1,46 +0,0 @@
/*
* Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
package sun.jvm.hotspot.debugger.proc.x86;
import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.debugger.x86.*;
import sun.jvm.hotspot.debugger.proc.*;
public class ProcX86ThreadContext extends X86ThreadContext {
private ProcDebugger debugger;
public ProcX86ThreadContext(ProcDebugger debugger) {
super();
this.debugger = debugger;
}
public void setRegisterAsAddress(int index, Address value) {
setRegister(index, debugger.getAddressValue(value));
}
public Address getRegisterAsAddress(int index) {
return debugger.newAddress(getRegister(index));
}
}

@ -1,44 +0,0 @@
/*
* Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
package sun.jvm.hotspot.debugger.proc.x86;
import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.debugger.proc.*;
public class ProcX86ThreadFactory implements ProcThreadFactory {
private ProcDebugger debugger;
public ProcX86ThreadFactory(ProcDebugger debugger) {
this.debugger = debugger;
}
public ThreadProxy createThreadWrapper(Address threadIdentifierAddr) {
return new ProcX86Thread(debugger, threadIdentifierAddr);
}
public ThreadProxy createThreadWrapper(long id) {
return new ProcX86Thread(debugger, id);
}
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@ package sun.jvm.hotspot.debugger.remote;
import sun.jvm.hotspot.debugger.*;
/** An interface used only internally by the ProcDebugger to be able to
/** An interface used only internally by the RemoteDebuggerClient to be able to
create platform-specific Thread objects */
public interface RemoteThreadFactory {