# HG changeset patch # User Doug Simon # Date 1383923595 -3600 # Node ID c46e091cba57aeade37cb11fc298270051e41f28 # Parent a95336e4647470fff6937aac4ccf302328f39a49 intercept and report an error during debug value reporting but don't propagate it diff -r a95336e46474 -r c46e091cba57 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java Fri Nov 08 16:12:40 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java Fri Nov 08 16:13:15 2013 +0100 @@ -394,57 +394,64 @@ List topLevelMaps = DebugValueMap.getTopLevelMaps(); List debugValues = KeyRegistry.getDebugValues(); if (debugValues.size() > 0) { - ArrayList sortedValues = new ArrayList<>(debugValues); - Collections.sort(sortedValues); + try { + ArrayList sortedValues = new ArrayList<>(debugValues); + Collections.sort(sortedValues); - String summary = DebugValueSummary.getValue(); - if (summary == null) { - summary = "Complete"; - } - switch (summary) { - case "Name": - printSummary(topLevelMaps, sortedValues); - break; - case "Partial": { - DebugValueMap globalMap = new DebugValueMap("Global"); - for (DebugValueMap map : topLevelMaps) { - flattenChildren(map, globalMap); - } - globalMap.normalize(); - printMap(new DebugValueScope(null, globalMap), sortedValues); - break; + String summary = DebugValueSummary.getValue(); + if (summary == null) { + summary = "Complete"; } - case "Complete": { - DebugValueMap globalMap = new DebugValueMap("Global"); - for (DebugValueMap map : topLevelMaps) { - globalMap.addChild(map); + switch (summary) { + case "Name": + printSummary(topLevelMaps, sortedValues); + break; + case "Partial": { + DebugValueMap globalMap = new DebugValueMap("Global"); + for (DebugValueMap map : topLevelMaps) { + flattenChildren(map, globalMap); + } + globalMap.normalize(); + printMap(new DebugValueScope(null, globalMap), sortedValues); + break; } - globalMap.group(); - globalMap.normalize(); - printMap(new DebugValueScope(null, globalMap), sortedValues); - break; - } - case "Thread": - for (DebugValueMap map : topLevelMaps) { - TTY.println("Showing the results for thread: " + map.getName()); - map.group(); - map.normalize(); - printMap(new DebugValueScope(null, map), sortedValues); + case "Complete": { + DebugValueMap globalMap = new DebugValueMap("Global"); + for (DebugValueMap map : topLevelMaps) { + globalMap.addChild(map); + } + globalMap.group(); + globalMap.normalize(); + printMap(new DebugValueScope(null, globalMap), sortedValues); + break; } - break; - default: - throw new GraalInternalError("Unknown summary type: %s", summary); + case "Thread": + for (DebugValueMap map : topLevelMaps) { + TTY.println("Showing the results for thread: " + map.getName()); + map.group(); + map.normalize(); + printMap(new DebugValueScope(null, map), sortedValues); + } + break; + default: + throw new GraalInternalError("Unknown summary type: %s", summary); + } + if (reset) { + for (DebugValueMap topLevelMap : topLevelMaps) { + topLevelMap.reset(); + } + } + } catch (Throwable e) { + // Don't want this to change the exit status of the VM + PrintStream err = System.err; + err.println("Error while printing debug values:"); + e.printStackTrace(); } - if (reset) { - for (DebugValueMap topLevelMap : topLevelMaps) { - topLevelMap.reset(); - } - } - if (phase != null) { - TTY.println(""); - } else { - TTY.println(""); - } + } + if (phase != null) { + TTY.println(""); + } else { + TTY.println(""); } } }