3

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?

Little Bobby Tables
  • 5,261
  • 2
  • 39
  • 49
  • 1
    This worked for me: https://stackoverflow.com/questions/3916305/debugging-symbols-in-erlang – Nirro Mar 25 '14 at 20:23

2 Answers2

5

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

-compile(debug_info).
Adam Lindberg
  • 16,447
  • 6
  • 65
  • 85
  • 1
    You're right. Seems that the compile option is given (as seen when calling `Module:module_info()`) but not used. Other compile options do work (such as `export_all`). I'd report this as a bug on the [erlang-bugs mailing list](http://erlang.org/mailman/listinfo/erlang-bugs). – Adam Lindberg Jul 26 '11 at 15:01
0

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)

LorenzoS
  • 1
  • 1
  • 2