3

After overcoming some troubles with installation I tried to use erlang debugger on simple module:

I included -compile([debug_info]). option in source file and compiled with:

1> c(test_module).

This did not work as expected: After running

2> debugger:start().

the monitor window appeared, then I clicked

Module->Interpret...->test_module.erl

and got error

"Error when interpreting: test_module.erl: No debug_info in BEAM file".

Deleting -compile([debug_info]). line and changing

1> c(test_module).

to

1> c(test_module, [debug_info]).

solved the problem.

What is the difference between these two ways of setting compilation option, why one works and the other does not?

aronisstav
  • 7,755
  • 5
  • 23
  • 48
GSPdibbler
  • 405
  • 1
  • 9
  • 22
  • possible duplicate of [Requesting debug\_info in an Erlang module using -compile](http://stackoverflow.com/questions/6830271/requesting-debug-info-in-an-erlang-module-using-compile) – Steve Vinoski Jan 20 '14 at 02:38

1 Answers1

2

According to the docs, the two ways should be equivalent:

Note that all the options except the include path ({i,Dir}) can also be given in the file with a -compile([Option,...]). attribute.

(From Erlang -- compile doc)

Check this question for more info.

Community
  • 1
  • 1
aronisstav
  • 7,755
  • 5
  • 23
  • 48
  • Based on the comments in that question, the in file debug_info compile option did not work at time of comment. That would be worth admitting here rather than quoting inaccurate docs as truth. – bschlueter Apr 10 '16 at 03:15
  • 1
    The reported behaviour is a bug. It is likely that it was also reported as such by someone that saw the questions here. There shouldn't be a difference. – aronisstav Apr 10 '16 at 09:05
  • All I'm saying is that the docs you're quoting in your answer are wrong (regardless that they are intended to be correct), and therefore your answer is wrong, or at least incomplete. – bschlueter Apr 11 '16 at 00:47