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 `debug_line` instructions in roughly the same places that `line_coverage` would insert `executable_line` instructions, and it will maintain information about which variables the BEAM registers contain at each `debug_line` instruction. This information will be inserted into a "DbgB" chunk in the BEAM file. When a `debug_line` is executed, the current stack frame (if any) is guaranteed to be fully initialized. The number of live X registers is given as the second operand for the `debug_line` instruction (it is guaranteed that there are no "holes"). 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 `debug_line` to be able to easly find the beginning of the previous stack frame.
- Loading branch information
Showing
29 changed files
with
1,561 additions
and
136 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,6 +88,8 @@ line I | |
|
||
executable_line I I | ||
|
||
debug_line u u u => _ | ||
|
||
allocate t t | ||
allocate_heap t I t | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,6 +88,8 @@ line I | |
|
||
executable_line I I | ||
|
||
debug_line u u u => _ | ||
|
||
allocate t t | ||
allocate_heap t I t | ||
|
||
|
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.