From ac3217d7de731185e65e1c381d96a0841f683ff2 Mon Sep 17 00:00:00 2001 From: "Keith W. Campbell" Date: Tue, 18 Sep 2018 16:35:31 -0400 Subject: [PATCH 1/2] Fix typo Signed-off-by: Keith W. Campbell --- .../classes/com/ibm/jvm/dtfjview/commands/helpers/Utils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jcl/src/openj9.dtfjview/share/classes/com/ibm/jvm/dtfjview/commands/helpers/Utils.java b/jcl/src/openj9.dtfjview/share/classes/com/ibm/jvm/dtfjview/commands/helpers/Utils.java index 4d897a6cd30..ee5b3d153b0 100644 --- a/jcl/src/openj9.dtfjview/share/classes/com/ibm/jvm/dtfjview/commands/helpers/Utils.java +++ b/jcl/src/openj9.dtfjview/share/classes/com/ibm/jvm/dtfjview/commands/helpers/Utils.java @@ -791,7 +791,7 @@ public static String padWithZeroes(String unpadded, int desiredLength) return output; } - public static Iterator getAddressSapceSectionInfo(Image loadedImage){ + public static Iterator getAddressSpaceSectionInfo(Image loadedImage) { Iterator itAddressSpace = loadedImage.getAddressSpaces(); Vector vSections = new Vector(); while(itAddressSpace.hasNext()){ From d2f35c7114d13f91c2e4b5e135366d001ec585e0 Mon Sep 17 00:00:00 2001 From: "Keith W. Campbell" Date: Tue, 18 Sep 2018 17:45:45 -0400 Subject: [PATCH 2/2] Handle printing wide registers Signed-off-by: Keith W. Campbell --- .../com/ibm/dtfj/image/j9/ImageRegister.java | 4 +-- .../infocommands/InfoThreadCommand.java | 25 +++++++++++++------ 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/jcl/src/openj9.dtfj/share/classes/com/ibm/dtfj/image/j9/ImageRegister.java b/jcl/src/openj9.dtfj/share/classes/com/ibm/dtfj/image/j9/ImageRegister.java index ed39e28925c..087c49d3398 100644 --- a/jcl/src/openj9.dtfj/share/classes/com/ibm/dtfj/image/j9/ImageRegister.java +++ b/jcl/src/openj9.dtfj/share/classes/com/ibm/dtfj/image/j9/ImageRegister.java @@ -1,6 +1,6 @@ /*[INCLUDE-IF Sidecar18-SE]*/ /******************************************************************************* - * Copyright (c) 2004, 2017 IBM Corp. and others + * Copyright (c) 2004, 2018 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -55,7 +55,7 @@ public Number getValue() throws CorruptDataException } public String toString() { - return _name + ":" + Long.toHexString(_value.longValue()); + return String.format("%s:%x", _name, _value); } } diff --git a/jcl/src/openj9.dtfjview/share/classes/com/ibm/jvm/dtfjview/commands/infocommands/InfoThreadCommand.java b/jcl/src/openj9.dtfjview/share/classes/com/ibm/jvm/dtfjview/commands/infocommands/InfoThreadCommand.java index f1b470701f6..5c100e2b9d2 100644 --- a/jcl/src/openj9.dtfjview/share/classes/com/ibm/jvm/dtfjview/commands/infocommands/InfoThreadCommand.java +++ b/jcl/src/openj9.dtfjview/share/classes/com/ibm/jvm/dtfjview/commands/infocommands/InfoThreadCommand.java @@ -24,6 +24,7 @@ import java.io.PrintStream; import java.lang.reflect.Modifier; +import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -284,15 +285,13 @@ private boolean printThreadInfo(String id, Map threads) public void printRegisters(ImageThread it) { out.print(" registers:"); - out.print("\n"); - int count = 0; Iterator itImageRegister = it.getRegisters(); while (itImageRegister.hasNext()) { if (count % 4 == 0) { - if (0 != count) out.print("\n"); - out.print(" "); + out.print("\n "); } + out.print(" "); ImageRegister ir = (ImageRegister)itImageRegister.next(); printRegisterInfo(ir); count++; @@ -304,13 +303,24 @@ public void printRegisterInfo(ImageRegister ir) { out.print(Utils.padWithSpaces(ir.getName(), 6) + " = "); try { - long registerValue = ir.getValue().longValue(); + Number value = ir.getValue(); + if (value instanceof BigInteger) { + BigInteger bigValue = (BigInteger) value; + int width = bigValue.bitLength(); + if (width > 64) { + // round up to a multiple of 64 bits + int paddedBits = ((width - 1) | 63) + 1; + out.print("0x" + Utils.padWithZeroes(bigValue.toString(16), paddedBits / 4)); + return; + } + } + long registerValue = value.longValue(); if (_pointerSize > 32) { out.print("0x" + Utils.toFixedWidthHex(registerValue)); } else { if (_is_zOS) { // Show high and low word separated by '_' as in IPCS etc - out.print("0x" + Utils.toFixedWidthHex((int)(registerValue >> 32)) + "_" + - Utils.toFixedWidthHex((int)registerValue)); + out.print("0x" + Utils.toFixedWidthHex((int)(registerValue >> 32)) + + "_" + Utils.toFixedWidthHex((int)registerValue)); } else { out.print("0x" + Utils.toFixedWidthHex((int)registerValue)); } @@ -318,7 +328,6 @@ public void printRegisterInfo(ImageRegister ir) } catch (CorruptDataException e) { out.print(Exceptions.getCorruptDataExceptionString()); } - out.print(" "); } public void printStackSection(ImageSection is)