8218947: jdb threads command should print threadID in decimal, not hex
Print objectIDs in decimal. Reviewed-by: sspitsyn, dholmes, jcbeyler
This commit is contained in:
parent
196d73c4ef
commit
c296f4ae0d
@ -211,58 +211,14 @@ class Env {
|
||||
ReferenceType clazz = ref.referenceType();
|
||||
long id = ref.uniqueID();
|
||||
if (clazz == null) {
|
||||
return toHex(id);
|
||||
return Long.toString(id);
|
||||
} else {
|
||||
return MessageOutput.format("object description and hex id",
|
||||
return MessageOutput.format("object description and id",
|
||||
new Object [] {clazz.name(),
|
||||
toHex(id)});
|
||||
Long.toString(id)});
|
||||
}
|
||||
}
|
||||
|
||||
/** Convert a long to a hexadecimal string. */
|
||||
static String toHex(long n) {
|
||||
char s1[] = new char[16];
|
||||
char s2[] = new char[18];
|
||||
|
||||
/* Store digits in reverse order. */
|
||||
int i = 0;
|
||||
do {
|
||||
long d = n & 0xf;
|
||||
s1[i++] = (char)((d < 10) ? ('0' + d) : ('a' + d - 10));
|
||||
} while ((n >>>= 4) > 0);
|
||||
|
||||
/* Now reverse the array. */
|
||||
s2[0] = '0';
|
||||
s2[1] = 'x';
|
||||
int j = 2;
|
||||
while (--i >= 0) {
|
||||
s2[j++] = s1[i];
|
||||
}
|
||||
return new String(s2, 0, j);
|
||||
}
|
||||
|
||||
/** Convert hexadecimal strings to longs. */
|
||||
static long fromHex(String hexStr) {
|
||||
String str = hexStr.startsWith("0x") ?
|
||||
hexStr.substring(2).toLowerCase() : hexStr.toLowerCase();
|
||||
if (hexStr.length() == 0) {
|
||||
throw new NumberFormatException();
|
||||
}
|
||||
|
||||
long ret = 0;
|
||||
for (int i = 0; i < str.length(); i++) {
|
||||
int c = str.charAt(i);
|
||||
if (c >= '0' && c <= '9') {
|
||||
ret = (ret * 16) + (c - '0');
|
||||
} else if (c >= 'a' && c <= 'f') {
|
||||
ret = (ret * 16) + (c - 'a' + 10);
|
||||
} else {
|
||||
throw new NumberFormatException();
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static ReferenceType getReferenceTypeFromToken(String idToken) {
|
||||
ReferenceType cls = null;
|
||||
if (Character.isDigit(idToken.charAt(0))) {
|
||||
|
@ -235,7 +235,7 @@ public class TTYResources extends java.util.ListResourceBundle {
|
||||
{"Not owned", " Not owned"},
|
||||
{"Not waiting for a monitor", " Not waiting for a monitor"},
|
||||
{"Nothing suspended.", "Nothing suspended."},
|
||||
{"object description and hex id", "({0}){1}"},
|
||||
{"object description and id", "({0}){1}"},
|
||||
{"Operation is not supported on the target VM", "Operation is not supported on the target VM"},
|
||||
{"operation not yet supported", "operation not yet supported"},
|
||||
{"Owned by:", " Owned by: {0}, entry count: {1,number,integer}"},
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2019, 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
|
||||
@ -94,7 +94,13 @@ public class interrupt001 extends JdbTest {
|
||||
|
||||
static int numThreads = nsk.jdb.interrupt.interrupt001.interrupt001a.numThreads;
|
||||
|
||||
private static Pattern tidPattern = Pattern.compile("(0x[0-9a-f]+)");
|
||||
/*
|
||||
* Pattern for finding the thread ID in a line like the following:
|
||||
* (nsk.jdb.interrupt.interrupt001.interrupt001a$MyThread)651 Thread-0 cond. waiting
|
||||
* Note we can't match on DEBUGGEE_THREAD because it includes a $, which Pattern
|
||||
* uses to match the end of a line.
|
||||
*/
|
||||
private static Pattern tidPattern = Pattern.compile("\\(.+" + MYTHREAD + "\\)(\\S+)");
|
||||
|
||||
protected void runCases() {
|
||||
String[] reply;
|
||||
|
Loading…
Reference in New Issue
Block a user