Requesting debug_info in an Erlang module using -c

2019-07-06 23:43发布

I want to force the Erlang compiler to generate debug info for specific modules whenever I compile them, without having to add the debug_info argument to the compilation command. I tried adding

-compile([debug_info]).

to the module file, but running c(my_module) did not include the debug info in the beam file.

Is there a way to do this, or debug information can not be added from the module source file itself?

2条回答
放荡不羁爱自由
2楼-- · 2019-07-07 00:18

Use the -compile directive without the enclosing list around the option:

-compile(debug_info).
查看更多
啃猪蹄的小仙女
3楼-- · 2019-07-07 00:28

This works for me, even if it's a bit unconvenient. From the shell:

compile:file(my_module.erl, debug_info)

or

c(my_module.erl, debug_info)

查看更多
登录 后发表回答