How to use local_call Dbg function

I have been trying to get function call history for an application i’m developing.

Short of putting IO.puts at the start of each function call… is there a way the Dbg module (or any other module) can help with this?

I put this line in my application start:

defmodule BotHost do
  @moduledoc false

  use Application

  def start(_type, _args) do
    import Supervisor.Spec, warn: false

    Dbg.local_call(BotHost.Processor, :c)

It seems to do nothing…

Please any suggestions/ help.

Is there a better way to see a detailed function call trace while an application is working… more or less equivalent to adding IO.puts into each function call

1 Like

According to the docs (which where easier to find if you had at least linked the package you are talking about) that call should return a map, have you tried to inspect it?

1 Like

@NobbZ sorry for not linking to the docs

what i don’t understand is how it works.

I was expecting it to just dump function call logs to the console after it is enabled…
but it doesn’t seem to work that way

1 Like

I just skimmed the read me on github and it seems as if you need to enable call tracing for the process first via Dbg.trace(self(), :call). Also all tracing seems to be process local.

1 Like

Thanks will try that.

I think the Author of that lib also did this video, but it is for Erlang’s :dbg

1 Like

Thanks it works now.

Dbg.local_call(__MODULE__, :c)
Dbg.trace(self(), :call)
1 Like