Print the entire bytecode upon ASM verification failure
This commit is contained in:
@@ -224,14 +224,14 @@ public abstract class CodegenTestCase extends UsefulTestCase {
|
|||||||
private static boolean verifyAllFilesWithAsm(ClassFileFactory factory, ClassLoader loader) {
|
private static boolean verifyAllFilesWithAsm(ClassFileFactory factory, ClassLoader loader) {
|
||||||
boolean noErrors = true;
|
boolean noErrors = true;
|
||||||
for (OutputFile file : factory.asList()) {
|
for (OutputFile file : factory.asList()) {
|
||||||
noErrors &= verifyWithAsm(file.asByteArray(), loader);
|
noErrors &= verifyWithAsm(file, loader);
|
||||||
}
|
}
|
||||||
return noErrors;
|
return noErrors;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean verifyWithAsm(@NotNull byte[] bytecode, ClassLoader loader) {
|
private static boolean verifyWithAsm(@NotNull OutputFile file, ClassLoader loader) {
|
||||||
ClassNode classNode = new ClassNode();
|
ClassNode classNode = new ClassNode();
|
||||||
new ClassReader(bytecode).accept(classNode, 0);
|
new ClassReader(file.asByteArray()).accept(classNode, 0);
|
||||||
|
|
||||||
SimpleVerifier verifier = new SimpleVerifier();
|
SimpleVerifier verifier = new SimpleVerifier();
|
||||||
verifier.setClassLoader(loader);
|
verifier.setClassLoader(loader);
|
||||||
@@ -243,6 +243,8 @@ public abstract class CodegenTestCase extends UsefulTestCase {
|
|||||||
analyzer.analyze(classNode.name, method);
|
analyzer.analyze(classNode.name, method);
|
||||||
}
|
}
|
||||||
catch (AnalyzerException e) {
|
catch (AnalyzerException e) {
|
||||||
|
System.out.println(file.asText());
|
||||||
|
|
||||||
System.err.println(classNode.name + "::" + method.name + method.desc);
|
System.err.println(classNode.name + "::" + method.name + method.desc);
|
||||||
|
|
||||||
// Print the erroneous instruction
|
// Print the erroneous instruction
|
||||||
|
|||||||
Reference in New Issue
Block a user