I would like to learn an open source software used as a message broker(EMQTT https://github.com/emqtt/emqttd), but when I am trying to change some code and trace how messages flow in it, there comes an problem that the Intellij Idea seems can only debug one Erlang function or one module at one time. Is there any way that I could debug the whole project and trace it with break point instead of debugging them in function one by one?

- 1,719
- 1
- 23
- 32
3 Answers
After some days of tries, I have found a method that could be used do debug with Intellij Idea, it is not as prefect as the method I would like to find, but it helps on some degree, just post it here for someone in need to reference.
- cd in to the directory where your *.erl file is in.
compile with c("your erl file", debug_info). There must be a debug_info when compile, otherwise, the debug will raise error: "no debug info in beam file".
config parameters according to your module, below figure is for reference. You may need provide function args if your function needs args
ps: This is relative redundant to compile with shell, but it is the only method I found could works, if no beam file is supplied, it always raise error: "no beam file".
If anyone has a better method, please give me a help whether by answer this question or a comment, thanks a lot!

- 1,719
- 1
- 23
- 32
Intellij Uses rebar as project manager. rebar was deprecated and rebar3 (new version of rebar) is available with advanced features.
You can use rebar3 and its advanced features for running tests & dialyzer.
EMQTT supports travis !
You can fork it and enable travis in your project.
travis is a test platform and will test your project after every change.
for more info see travis docs

- 1,626
- 11
- 19
-
The Erlang plugin for Intellij does support rebar3 since beginning of 2017. But note rebar and the Erlang debugger have no relation, so whether Intellij supports rebar3 or not is of no influence for the question. Travis is not owned by github. – marco.m Jun 14 '17 at 11:17
Your solution of having the source files and artefacts in one directory seem to be the only way to use the Intellij debugger. Since usually the source files and artefacts are not in the same directory, this behaviour seems odd. I have opened an issue therefore (https://github.com/ignatov/intellij-erlang/issues/811).
A solution which works with rebar3 and eunit is described in How to debug erlang code during rebar3 eunit?. You can start rebar3 as test shell in Intellij by using the support for running a rebar3 command provided with the erlang plugin.

- 23
- 4