debugger agent: handle asm issues

This commit is contained in:
Egor.Ushakov
2017-10-04 16:31:00 +03:00
parent 501cf3065e
commit 0515ef6736

View File

@@ -66,9 +66,23 @@ public class CaptureAgent {
}
}
instrumentation.appendToSystemClassLoaderSearch(new JarFile(asmPath));
try {
instrumentation.appendToSystemClassLoaderSearch(new JarFile(asmPath));
}
catch (Exception e) {
String report = "Capture agent: unable to use the provided asm lib";
try {
Class.forName("org.jetbrains.org.objectweb.asm.MethodVisitor");
System.out.println(report + ", will use asm from the classpath");
}
catch (ClassNotFoundException e1) {
System.out.println(report + ", exiting");
return;
}
}
instrumentation.addTransformer(new CaptureTransformer());
for (Class aClass : instrumentation.getAllLoadedClasses()) {
String name = aClass.getName().replaceAll("\\.", "/");
if (myCapturePoints.containsKey(name) || myInsertPoints.containsKey(name)) {