-
Notifications
You must be signed in to change notification settings - Fork 293
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Exception probe custom instrumentation
When there is only exception probes at a specific ode location we strip down the instrumentation to only capture values inside the catch (when an exception happens). this way, in normal execution no overhead is pay for an exception probe
- Loading branch information
Showing
6 changed files
with
138 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...nt-debugger/src/main/java/com/datadog/debugger/instrumentation/ExceptionInstrumentor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.datadog.debugger.instrumentation; | ||
|
||
import com.datadog.debugger.probe.ProbeDefinition; | ||
import datadog.trace.bootstrap.debugger.Limits; | ||
import datadog.trace.bootstrap.debugger.ProbeId; | ||
import java.util.List; | ||
import org.objectweb.asm.tree.AbstractInsnNode; | ||
import org.objectweb.asm.tree.InsnList; | ||
|
||
public class ExceptionInstrumentor extends CapturedContextInstrumentor { | ||
|
||
public ExceptionInstrumentor( | ||
ProbeDefinition definition, | ||
MethodInfo methodInfo, | ||
List<DiagnosticMessage> diagnostics, | ||
List<ProbeId> probeIds) { | ||
super(definition, methodInfo, diagnostics, probeIds, true, false, Limits.DEFAULT); | ||
} | ||
|
||
@Override | ||
public InstrumentationResult.Status instrument() { | ||
processInstructions(); // fill returnHandlerLabel | ||
addFinallyHandler(methodEnterLabel, returnHandlerLabel); | ||
installFinallyBlocks(); | ||
return InstrumentationResult.Status.INSTALLED; | ||
} | ||
|
||
@Override | ||
protected InsnList getBeforeReturnInsnList(AbstractInsnNode node) { | ||
return null; | ||
} | ||
|
||
@Override | ||
protected InsnList getReturnHandlerInsnList() { | ||
return new InsnList(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters