-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement support for debug information in the runtime system
This commit implements support for loading the debug information from a BEAM file and the `code:get_debug_info/1` BIF for retrieving the debug information. As an example, given the following module: -module(example). % 1 -export([foo/1]). % 2 foo(A) -> % 4 case A of % 5 0 -> % 6 B = 1, % 7 io:format("~p\n", [B]); % 8 1 -> % 9 C = [1,2,3], % 10 io:format("~p\n", [C]) % 11 end, % 12 A. % 13 sign(N) when N < 0 -> 1; % 15 sign(N) when N == 0 -> 0; % 16 sign(_) -> 1. % 17 here is how to compile it with BEAM debug information and display the debug information: 1> c(example, beam_debug_info). {ok,example} 2> code:get_debug_info(example). [{4,{entry,[{1,{x,0}}]}}, {5,{1,[{<<"A">>,{y,0}}]}}, {7,{1,[{<<"A">>,{y,0}}]}}, {8,{1,[{<<"B">>,{value,1}},{<<"A">>,{y,0}}]}}, {10,{1,[{<<"A">>,{y,0}}]}}, {11,{1,[{<<"C">>,{value,[1,2,3]}},{<<"A">>,{y,0}}]}}, {13,{1,[{<<"A">>,{y,0}}]}}, {15,{entry,[{1,{x,0}}]}}, {15,{none,[{<<"N">>,{x,0}}]}}, {16,{none,[{<<"N">>,{x,0}}]}}, {17,{none,[]}}] List elements having the frame size `entry` refers to a `debug_line` instruction at the beginning of the function (before all clauses). Note that the line number for such entries *may* be the same as the line number for the first clause. All other line numbers are guaranteed to be unique.
- Loading branch information
Showing
16 changed files
with
620 additions
and
15 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
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.