DEBUG-2334 repair instrumentation of virtual and later-defined methods #4106
+112
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR changes DI instrumentation to not fail if the current definition of a method is not available, when installing method probes.
Motivation:
DI instrumentation code assumed it was able to obtain the current definition of the target method for method probes. This is not correct when 1) class is defined but the target method is not (perhaps because the method would be defined later), and 2) when the method is virtual and handled by
method_missing
.Change log entry
None
Additional Notes:
For virtual and later-defined methods, the stack trace reported to backend currently would not include the method itself (since we don't have its definition to get its location from). Later if/when begin/end trace points are added to method instrumentation we should be able to obtain the actual method location at probe invocation time and fill in the top stack frame then.
How to test the change?
Unit tests are included