- java.lang.Object
-
- com.ibm.j9ddr.tools.ddrinteractive.CommandUtils
-
public class CommandUtils extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static String
HEX_SUFFIX
static int
RADIX_BINARY
static int
RADIX_DECIMAL
static int
RADIX_HEXADECIMAL
static BigInteger
UDATA_MAX_32BIT
static BigInteger
UDATA_MAX_64BIT
-
Constructor Summary
Constructors Constructor Description CommandUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
dbgError(PrintStream out, String msg)
static void
dbgPrint(PrintStream out, String msg)
static void
dbgPrint(PrintStream out, String msg, Object... args)
static boolean
fieldExists(Class<?> class1, String string)
static long
followPointerFromStructure(Context context, String structureName, long structureAddress, String fieldName)
static String
getCStringAtAddress(IProcess process, long address)
static String
getCStringAtAddress(IProcess process, long address, long maxLength)
static Logger
getLogger()
static long
getOffsetForField(StructureReader.StructureDescriptor desc, String fieldName)
static BigInteger
longToBigInteger(long pointer)
This method converts long type pointer into BigInteger instance.static byte[]
longToByteArray(long index, int size)
static BigInteger
parseNumber(String number)
This method parses given number into a BigIntegerstatic long
parsePointer(String input, boolean is64bit)
This method parses the given address string and return the address value in type long.
-
-
-
Field Detail
-
UDATA_MAX_64BIT
public static final BigInteger UDATA_MAX_64BIT
-
UDATA_MAX_32BIT
public static final BigInteger UDATA_MAX_32BIT
-
RADIX_BINARY
public static final int RADIX_BINARY
- See Also:
- Constant Field Values
-
RADIX_DECIMAL
public static final int RADIX_DECIMAL
- See Also:
- Constant Field Values
-
RADIX_HEXADECIMAL
public static final int RADIX_HEXADECIMAL
- See Also:
- Constant Field Values
-
HEX_SUFFIX
public static final String HEX_SUFFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
parsePointer
public static long parsePointer(String input, boolean is64bit) throws DDRInteractiveCommandException
This method parses the given address string and return the address value in type long.- Parameters:
input
- String representation of the address of a pointer.is64bit
- True, if the platform where core file is generated is 64 bit platform. False, otherwise.- Returns:
- Address of the parsed pointer. Return 0, if any parse error occurs.
- Throws:
DDRInteractiveCommandException
-
longToBigInteger
public static BigInteger longToBigInteger(long pointer)
This method converts long type pointer into BigInteger instance. Since long type pointer can be negative too, such values converted into positive BigInteger by treating the bits of long as UDATA.- Parameters:
pointer
- long data type pointer.- Returns:
- BigInteger instance of the given pointer
-
parseNumber
public static BigInteger parseNumber(String number) throws DDRInteractiveCommandException
This method parses given number into a BigInteger- Parameters:
number
- String representation of the given number to be parsed- Returns:
- BigInteger instance of the parsed number
- Throws:
DDRInteractiveCommandException
-
getLogger
public static Logger getLogger()
-
followPointerFromStructure
public static long followPointerFromStructure(Context context, String structureName, long structureAddress, String fieldName) throws MemoryFault, DDRInteractiveCommandException
-
getOffsetForField
public static long getOffsetForField(StructureReader.StructureDescriptor desc, String fieldName) throws NoSuchFieldException
- Throws:
NoSuchFieldException
-
getCStringAtAddress
public static String getCStringAtAddress(IProcess process, long address) throws CorruptDataException
- Throws:
CorruptDataException
-
getCStringAtAddress
public static String getCStringAtAddress(IProcess process, long address, long maxLength) throws CorruptDataException
- Throws:
CorruptDataException
-
dbgError
public static void dbgError(PrintStream out, String msg)
-
dbgPrint
public static void dbgPrint(PrintStream out, String msg)
-
dbgPrint
public static void dbgPrint(PrintStream out, String msg, Object... args)
-
longToByteArray
public static byte[] longToByteArray(long index, int size)
-
-