Skip to content

fix computeFrames call#11920

Open
jpbempel wants to merge 1 commit into
masterfrom
jpbempel/fix-compute-frames
Open

fix computeFrames call#11920
jpbempel wants to merge 1 commit into
masterfrom
jpbempel/fix-compute-frames

Conversation

@jpbempel

@jpbempel jpbempel commented Jul 12, 2026

Copy link
Copy Markdown
Member

What Does This Do

make sure it is called before any instrumentation. for CaptureContextInstrumenter, processInstructions is called after some instrumentation at the beginning of the method. so extract computeFrames outside of processInstructions and return directly the frames Map.

Motivation

Additional Notes

Contributor Checklist

Jira ticket: DEBUG-5816

make sure it is called before any instrumentation.
for CaptureContextInstrumenter, processInstructions is called after
some instrumentation at the beginning of the method.
so extract computeFrames outside of processInstructions and return
directly the frames Map.
@jpbempel jpbempel requested a review from a team as a code owner July 12, 2026 13:56
@jpbempel jpbempel requested review from P403n1x87 and removed request for a team July 12, 2026 13:56
@jpbempel jpbempel added the comp: debugger Dynamic Instrumentation label Jul 12, 2026
@dd-octo-sts

dd-octo-sts Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Hi! 👋 Thanks for your pull request! 🎉

To help us review it, please make sure to:

  • Add at least one type, and one component or instrumentation label to the pull request

If you need help, please check our contributing guidelines.

@jpbempel jpbempel added tag: no release notes Changes to exclude from release notes type: bug fix Bug fix labels Jul 12, 2026

@datadog-prod-us1-6 datadog-prod-us1-6 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Datadog Autotest: PASS

More details

Reviewed PR moving frame computation before instrumentation in debugger's bytecode processing. All call sites correctly updated across five instrumenter classes, signatures changed consistently, and no behavioral regressions identified. The fix addresses a real problem where analyzing instrumented bytecode could fail, by computing frames on the original bytecode first.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Datadog Autotest · Commit 6599436 · What is Autotest? · Any feedback? Reach out in #autotest

@datadog-prod-us1-6

This comment has been minimized.

@dd-octo-sts

dd-octo-sts Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

🟢 Java Benchmark SLOs — All performance SLOs passed

Suite Status
Startup 🟢 pass

SLO thresholds are defined here based on automatically generated metrics. A warning is raised when results are within 5% of the threshold.

PR vs. master results
Scenario Candidate master Δ (95% CI of mean)
startup:insecure-bank:iast:Agent 13.90 s 13.87 s [-0.5%; +0.9%] (no difference)
startup:insecure-bank:tracing:Agent 12.91 s 12.95 s [-1.1%; +0.6%] (no difference)
startup:petclinic:appsec:Agent 17.55 s 17.15 s [+1.4%; +3.3%] (significantly worse)
startup:petclinic:iast:Agent 17.42 s 17.62 s [-2.0%; -0.3%] (maybe better)
startup:petclinic:profiling:Agent 17.30 s 17.47 s [-2.2%; +0.2%] (no difference)
startup:petclinic:sca:Agent 17.51 s 17.47 s [-0.6%; +1.1%] (no difference)
startup:petclinic:tracing:Agent 16.50 s 16.24 s [-2.7%; +5.9%] (no difference)

Commit: 65994362 · CI Pipeline · Benchmarking Platform UI


Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts debugger probe bytecode instrumentation to ensure ASM frame analysis (computeFrames) runs before any instruction list mutations, then passes the precomputed frames into processInstructions for return-rewrite/stack-cleanup logic.

Changes:

  • Refactored Instrumenter.computeFrames to return the computed frame map, and updated processInstructions to accept it as an argument.
  • Updated Span/Metric/Exception/CapturedContext instrumenters to compute frames up-front and pass them into processInstructions.
  • Improved the AnalyzerException debug log to include the method descriptor.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
dd-java-agent/agent-debugger/src/main/java/com/datadog/debugger/instrumentation/SpanInstrumenter.java Precomputes frames before span instrumentation and passes them to processInstructions.
dd-java-agent/agent-debugger/src/main/java/com/datadog/debugger/instrumentation/MetricInstrumenter.java Precomputes frames for EXIT instrumentation before rewriting returns.
dd-java-agent/agent-debugger/src/main/java/com/datadog/debugger/instrumentation/Instrumenter.java Refactors frame computation API and updates instruction processing to take precomputed frames; enhances debug logging.
dd-java-agent/agent-debugger/src/main/java/com/datadog/debugger/instrumentation/ExceptionInstrumenter.java Precomputes frames before processing instructions to set up return handling.
dd-java-agent/agent-debugger/src/main/java/com/datadog/debugger/instrumentation/CapturedContextInstrumenter.java Computes frames before early method-entry instrumentation, then uses them for return processing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +196 to +197
protected static Map<AbstractInsnNode, Frame<BasicValue>> computeFrames(
String owner, MethodNode methodNode) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not a problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: debugger Dynamic Instrumentation tag: no release notes Changes to exclude from release notes type: bug fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants