Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle printing wide registers #2931

Merged
merged 2 commits into from
Sep 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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()){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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++;
Expand All @@ -304,21 +303,31 @@ 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));
}
}
} catch (CorruptDataException e) {
out.print(Exceptions.getCorruptDataExceptionString());
}
out.print(" ");
}

public void printStackSection(ImageSection is)
Expand Down