in src/main/java/com/intellij/rt/debugger/agent/CaptureAgent.java [23:75]
public static void init(Properties properties, Instrumentation instrumentation) {
ourInstrumentation = instrumentation;
try {
applyProperties(properties);
if (instrumentThrowable()) {
instrumentation.addTransformer(new ThrowableTransformer(), true);
}
// remember already loaded and not instrumented classes to skip them during retransform
for (Class aClass : instrumentation.getAllLoadedClasses()) {
if (instrumentThrowable() && ThrowableTransformer.THROWABLE_NAME.equals(getInternalClsName(aClass))) {
instrumentation.retransformClasses(aClass);
}
else {
List<InstrumentPoint> points = myInstrumentPoints.get(getInternalClsName(aClass));
if (points != null) {
for (InstrumentPoint point : points) {
if (!point.myCapture) {
mySkipped.add(aClass);
}
}
}
}
}
instrumentation.addTransformer(new CaptureTransformer(), true);
// Trying to reinstrument java.lang.Thread
// fails with dcevm, does not work with other vms :(
//for (Class aClass : instrumentation.getAllLoadedClasses()) {
// String name = aClass.getName().replaceAll("\\.", "/");
// if (myCapturePoints.containsKey(name) || myInsertPoints.containsKey(name)) {
// try {
// instrumentation.retransformClasses(aClass);
// }
// catch (UnmodifiableClassException e) {
// e.printStackTrace();
// }
// }
//}
setupJboss();
if (CaptureStorage.DEBUG) {
System.out.println("Capture agent: ready");
}
}
catch (Throwable e) {
System.err.println("Critical error in IDEA Async Stack Traces instrumenting agent. Agent is now disabled. Please report to IDEA support:");
e.printStackTrace();
}
}