Skip to content

Commit 24bffdf

Browse files
committed
retain line number and label instructions
1 parent 59ff392 commit 24bffdf

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

dd-java-agent/agent-debugger/src/main/java/com/datadog/debugger/instrumentation/CodeOriginInstrumentor.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import org.objectweb.asm.tree.AbstractInsnNode;
1919
import org.objectweb.asm.tree.InsnList;
2020
import org.objectweb.asm.tree.LabelNode;
21+
import org.objectweb.asm.tree.LineNumberNode;
2122
import org.objectweb.asm.tree.MethodInsnNode;
2223

2324
public class CodeOriginInstrumentor extends Instrumentor {
@@ -66,7 +67,11 @@ private AbstractInsnNode stripSetup() {
6667
AbstractInsnNode next = iterator.next();
6768
if (buildDescription(next).equals(MARKER)) {
6869
insertionPoint = next.getPrevious();
69-
while (iterator.hasNext() && !buildDescription(next = iterator.next()).equals(CAPTURE)) {}
70+
while (iterator.hasNext() && !buildDescription(next = iterator.next()).equals(CAPTURE)) {
71+
if (next instanceof LineNumberNode || next instanceof LabelNode) {
72+
list.add(next);
73+
}
74+
}
7075

7176
if (!iterator.hasNext()) {
7277
return null;

0 commit comments

Comments
 (0)