Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugging the mongooseim for modules and hooks development #1788

Closed
awshelpdesk opened this issue Apr 2, 2018 · 9 comments
Closed

Debugging the mongooseim for modules and hooks development #1788

awshelpdesk opened this issue Apr 2, 2018 · 9 comments

Comments

@awshelpdesk
Copy link

MongooseIM version: 2.1.1
Installed from: source at github
Erlang/OTP version: 20
Describe the issue.
I need to debug mongooseim modules and hooks. But when i do start mongooseim and then start ./mongooseimctl debug, i get following error when executing the command im(). in erlang shell.

Call to i:im/0 in application debugger failed.

Do let me know how can i rectify the issue as i am learning mongooseim developement.

Thanks

@GalaxyGorilla
Copy link
Contributor

GalaxyGorilla commented Apr 3, 2018

im() is a shortcut for debugger:start() and the debugger application is by default not included in erlang releases (iirc) by rebar3/relx. You can simply add the debugger app in the rebar.config and things are working as expected.

@awshelpdesk
Copy link
Author

Thanks a lot GalaxyGorilla.

@shubham1164
Copy link

Hi GalaxyGorilla/awshelpdesk, can you tell me how to enable im(). on MongooseIM?

@GalaxyGorilla
Copy link
Contributor

IIRC you just need to add debugger using export APPS=debugger when creating a release. So you need to build the release yourself.

@shubham1164
Copy link

shubham1164 commented Nov 15, 2018

You mean I need to add export APPS=debugger inside rebar.config like this?

image

Its not working.
I am using the Mongooseim from source code and compiling it on MAC using the below:
$ sudo ./rebar3 compile
$ sudo make rel
$ sudo /Users/MAC/Documents/Workspace/MongooseIm/MongooseIM/_build/prod/rel/mongooseim/bin/mongooseimctl live

Where should I use export APPS=debugger and should I use all the above steps after that to make it work?
I can confirm that im(). is working in the erl shell like:
$ erl
$ im(). //working here

@GalaxyGorilla
Copy link
Contributor

GalaxyGorilla commented Nov 15, 2018

Try this:

$ export APPS=debugger
$ ./rebar3 compile
$ make rel
$ /Users/MAC/Documents/Workspace/MongooseIm/MongooseIM/_build/prod/rel/mongooseim

However, I did not try this ...

EDIT: What is all the sudo stuff doing there?

@shubham1164
Copy link

No, still same, not working. I need to use sudo otherwise I get lots of Permission denied errors

@GalaxyGorilla
Copy link
Contributor

Just figured it out, add debugger and wx like this in the rebar script:

-RequiredApps = fun() -> [mongooseim, inets, tools] end,
+RequiredApps = fun() -> [mongooseim, inets, tools, debugger, wx] end,

I am pretty sure you can also do this via env variables, but currently I have no time to figure this out.

@shubham1164
Copy link

You are awesome. It worked 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants