Skip to content

Commit 5cb06ce

Browse files
committed
8234277: ClhsdbLauncher should enable verbose exceptions and do a better job of detecting SA failures
Reviewed-by: sspitsyn, ysuenaga
1 parent eb6beea commit 5cb06ce

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

test/hotspot/jtreg/ProblemList.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ serviceability/sa/ClhsdbPrintAs.java 8193639 solaris-all
115115
serviceability/sa/ClhsdbPrintStatics.java 8193639 solaris-all
116116
serviceability/sa/ClhsdbPstack.java 8193639 solaris-all
117117
serviceability/sa/ClhsdbRegionDetailsScanOopsForG1.java 8193639 solaris-all
118-
serviceability/sa/ClhsdbScanOops.java 8193639 solaris-all
118+
serviceability/sa/ClhsdbScanOops.java 8193639,8235220,8230731 solaris-all,linux-x64,macosx-x64,windows-x64
119119
serviceability/sa/ClhsdbSource.java 8193639 solaris-all
120120
serviceability/sa/ClhsdbThread.java 8193639 solaris-all
121121
serviceability/sa/ClhsdbVmStructsDump.java 8193639 solaris-all

test/hotspot/jtreg/serviceability/sa/ClhsdbLauncher.java

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ private void attach(long lingeredAppPid)
7171
cmdStringList = SATestUtils.addPrivileges(cmdStringList);
7272
}
7373
ProcessBuilder processBuilder = new ProcessBuilder(cmdStringList);
74-
processBuilder.redirectError(ProcessBuilder.Redirect.INHERIT);
7574
toolProcess = processBuilder.start();
7675
}
7776

@@ -91,8 +90,6 @@ private void loadCore(String coreFileName)
9190
" and exe " + JDKToolFinder.getTestJDKTool("java"));
9291

9392
ProcessBuilder processBuilder = new ProcessBuilder(launcher.getCommand());
94-
processBuilder.redirectError(ProcessBuilder.Redirect.INHERIT);
95-
9693
toolProcess = processBuilder.start();
9794
}
9895

@@ -116,6 +113,17 @@ private String runCmd(List<String> commands,
116113
throw new RuntimeException("CLHSDB command must be provided\n");
117114
}
118115

116+
// Enable verbose exception tracing so we see the full exception backtrace
117+
// when there is a failure. We need to insert this command into the start
118+
// of the commands list. We can't just issue the "verbose true" command seperately
119+
// because code below won't work correctly if all executed commands are
120+
// not in the commands list. And since it's immutable, we need to allocate
121+
// a mutable one.
122+
List<String> savedCommands = commands;
123+
commands = new java.util.LinkedList<String>();
124+
commands.add("verbose true");
125+
commands.addAll(savedCommands);
126+
119127
try (OutputStream out = toolProcess.getOutputStream()) {
120128
for (String cmd : commands) {
121129
out.write((cmd + "\n").getBytes());
@@ -134,8 +142,15 @@ private String runCmd(List<String> commands,
134142

135143
oa.shouldHaveExitValue(0);
136144
output = oa.getOutput();
145+
System.out.println("Output: ");
137146
System.out.println(output);
138147

148+
// This will detect most SA failures, including during the attach.
149+
oa.shouldNotMatch("^sun.jvm.hotspot.debugger.DebuggerException:.*$");
150+
// This will detect unexpected exceptions, like NPEs and asserts, that are caught
151+
// by sun.jvm.hotspot.CommandProcessor.
152+
oa.shouldNotMatch("^Error: .*$");
153+
139154
String[] parts = output.split("hsdb>");
140155
for (String cmd : commands) {
141156
int index = commands.indexOf(cmd) + 1;

0 commit comments

Comments
 (0)