Add call-targets to the info available via +beam_debug_info #9814
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.
Context
For implementing a stepping-into functionality, we need to know, given the current location of a suspended process, what are the possible next targets. At the moment, the edb debugger is relying on the AST we get via
+debug_info
. This however has several drawbacks; in particular we are forced to implement a code-analysis that is tricky to get right, requires maintenance as new language constructs are added (similar to what happens withint
) and limits this feature to modules that are backed by a file, and compiled with+debug_info
.Instead, we'd like this info to be provided by the compiler when
+beam_debug_info
is used, as an additional bit of data associated to each debug location.What we do here
code:get_debug_info/1
so that it uses a map, instead of a tuple, to return the data. This means we can add more keys in the future, without major API changescall FrameSize VarMappings
, we now use one call for theFrameSize
and an optionalcall
for the VarMappings. The first argument of the
call` now tell us what the payload in the second argument is.call
instructions and record their target. The targets we care about are of the form{M, F, A}
or{F, A}
, whereM
andF
can be atoms, if they are known statically, or a binary representing a user variable, for dynamic calls. We also allow plain user variables as target. This will allow edb to soon support stepping-into the target of a dynamic call.call
instruction is as a list of integers, binaries or atoms, as follows:[{M, F, A},...]
gets encoded as[A,M,F,...]
;[{F, A}, ...]
gets encoded as[A+256, F, ...]
;[V,...]
(for V a binary) gets encoded as[V,...]
We can then unambiguously reconstruct the list of targets from this list of terms