Skip to content

Commit

Permalink
fixup! compiler: Add support for debug information in BEAM files
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorng committed Nov 12, 2024
1 parent 5b8a8c9 commit ffd7c41
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions lib/compiler/test/beam_debug_info_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
init_per_group/2,end_per_group/2,
smoke/1,
fixed_bugs/1,
empty_module/1]).
empty_module/1,
call_in_call_args/1]).

suite() -> [{ct_hooks,[ts_install_cth]}].

Expand All @@ -43,7 +44,8 @@ all() ->
groups() ->
[{p,test_lib:parallel(),
[fixed_bugs,
empty_module]}].
empty_module,
call_in_call_args]}].

init_per_suite(Config) ->
id(Config),
Expand Down Expand Up @@ -698,6 +700,32 @@ empty_module(_Config) ->

ok.

call_in_call_args(Config) ->
M = ?FUNCTION_NAME,
PrivDir = proplists:get_value(priv_dir, Config),
SrcName = filename:join(PrivDir, atom_to_list(M) ++ ".erl"),

S = ~"""
-module(call_in_call_args).
-export([f/1]).
f(X) ->
bar:g(
bar:h(X),
id(X)
).
id(I) -> I.
""",

ok = file:write_file(SrcName, S),
{ok,M,Asm} = compile:file(SrcName, [report,beam_debug_info,binary,to_asm]),
{M,_,_,[{function,f,1,_,Is}|_],_} = Asm,
DebugLines = [I || I <- Is, element(1, I) =:= debug_line],
io:format("~p\n", [DebugLines]),
3 = length(DebugLines),

ok.

%%%
%%% Common utility functions.
%%%
Expand Down

0 comments on commit ffd7c41

Please sign in to comment.