Commit 31b959b
authored
[Dynamic Instrumentation] Fixed instrumentation error (InvalidProgramException) related retargeting of EH clauses (#5774)
## Summary of changes
Fixed `InvalidProgramException` thrown due to malformed bytecode born
from DI Line Probe instrumentation, discovered by Exploration Testing of
Method + Line Probes.
## Reason for change
When a customer chooses a line for instrumentation through DI, a bunch
of bytecode is being placed in front of the chosen line, to capture the
method state.
When the original line was a target of an exception handling clauses
(e.g the line was the beginning of a catch/finally blocks, the line was
the end of a try block, etc) - in those cases, we retarget the exception
handling pointers to point to the new bytecode being placed. The code
that handled it missed two assignment: TryEnd and HandlerEnd. Meaning,
when the target line was an end of finally/catch block or at the end of
a try block, we missed fixing the pointers, resulting in
`InvalidProgramException`.
## Implementation details
Correctly assinging `TryEnd` & `HandlerEnd` EH clauses.
## Test coverage
Four new tests were added, that previously were broken with
`InvalidProgramException`:
- `TryFinallyTest`.
- `AsyncTryFinallyTest`
- `TryCatchTest`
- `AsyncTryCatchTest`1 parent b5fd279 commit 31b959b
File tree
13 files changed
+1532
-3
lines changed- tracer
- src/Datadog.Tracer.Native
- test
- Datadog.Trace.Debugger.IntegrationTests/Approvals
- snapshots
- statuses
- test-applications/debugger/dependency-libs/Samples.Probes.TestRuns/SmokeTests
13 files changed
+1532
-3
lines changedLines changed: 8 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2497 | 2497 | | |
2498 | 2498 | | |
2499 | 2499 | | |
2500 | | - | |
| 2500 | + | |
| 2501 | + | |
| 2502 | + | |
| 2503 | + | |
2501 | 2504 | | |
2502 | 2505 | | |
2503 | 2506 | | |
2504 | 2507 | | |
2505 | 2508 | | |
2506 | | - | |
2507 | 2509 | | |
2508 | 2510 | | |
| 2511 | + | |
| 2512 | + | |
| 2513 | + | |
| 2514 | + | |
2509 | 2515 | | |
2510 | 2516 | | |
2511 | 2517 | | |
2512 | | - | |
2513 | 2518 | | |
2514 | 2519 | | |
2515 | 2520 | | |
| |||
0 commit comments