forked from erlang/otp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
compiler: Add support for debug information in BEAM files
The new `beam_debug_info` compiler option will insert `executable_line` instructions in the same way that `line_coverage` does, but it will also maintain information about which variables the BEAM registers contain at each `executable_line` instruction. This information will be inserted into a "DbgB" chunk in the BEAM file. Here is an example where the debug information translated to text has been inserted as comments before the lines they apply to: sum(A, B, _Ignored) -> %% no stack frame; A in x0, B in x1, _Ignored in x2 C = A + B, %% no stack frame; B in x1, C in x0 io:format("~p\n", [C]), %% stack frame size is 1; C in y0 D = 10 * C, %% stack frame size is 1; C in y0, D in x0 {ok,D}. Note that not all variables are available in the debug information. For example, before the call to `io:format/2`, the sum of A and B have overwritten the register that used to hold the value of A, and the value for _Ignore was wiped out by the `+` operation. The size of the current stack frame is also given at each executable line to be able to safely find the beginning of the previous stack frame. Scanning from the stack top is not safe, because not all slots (Y registers) are guaranteed to be initialized when an `executable_line` instruction is reached.
- Loading branch information
Showing
17 changed files
with
1,234 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.