3

I modified relx.config in a cowboy example,add runtime_tools {release, {echo_get_example, "1"}, [runtime_tools, echo_get]}. {extended_start_script, true}.

when I use dbg:start() -> dbg:tracer() -> .... nothing outputs when calls then functions. why?

柚子youthy
  • 113
  • 8

1 Answers1

1

Since you can actually call the dbg module you have most likely succeeded in including it in the release.

Are you connecting with a remote node? In that case, you have to tell dbg to trace on the node you're connected to:

debugger@localhost> dbg:tracer().
{ok,<0.35.0>}
debugger@localhost> dbg:n(target@host).
{ok,target@host}
debugger@localhost> dbg:p(all, call).
{ok,[{target@host,33},{debugger@localhost,34}]}
debugger@localhost> dbg:tp(...)

More details here and in the documentation for dbg.

Adam Lindberg
  • 16,447
  • 6
  • 65
  • 85
  • I'm not in remote node, take cowboy hello_world app for example. I just ran ```~/code/cowboy/examples/hello_world$ ./_rel/hello_world_example/bin/hello_world_example console``` it's my local node,but dbg nothing outputs – 柚子youthy Dec 11 '15 at 06:16
  • Perhaps you can create [your own tracer](http://erlang.org/doc/man/dbg.html#id68664)? Instead of the normal printout in that example, try `io:format(user, "~p~n", [Msg])`. That will print out to the local shell for sure. If that works, then something is redirecting your output from the shell to somewhere else. – Adam Lindberg Dec 14 '15 at 12:33