legoscia
legoscia

Reputation: 41528

Trace multiple functions using redbug from command line

When tracing function calls using redbug from an Erlang shell, I can trace multiple functions at the same time by passing a list of strings to redbug:start:

redbug:start(["foo:bar -> return", "bar:baz -> return"], []).

Using redbug from the command line, I can trace a single function without problems:

redbug -setcookie s3cret mynode@localhost "foo:bar->return"

But I can't seem to find a way to trace multiple functions from the command line. Is that possible? If so, how?

Upvotes: 3

Views: 315

Answers (1)

tkowal
tkowal

Reputation: 9289

./priv/bin/redbug -setcookie s3cret mynode@localhost '"foo:bar->return","foo:baz->return"'

or

 ./priv/bin/redbug -setcookie s3cret mynode@localhost '["foo:bar->return","foo:baz->return"]'

You can pass comma separated list of strings, but you can't use spaces. Redbug internally surrounds input with "[" and "]" and then tries to parse that expression with erl_scan and erl_parse. If it fails, then it passes unparsed string (that is why syntax for one function is easy). If it succeeds, it calls:

redbug:start(["foo:bar->return", "foo:baz->return"], []).

Upvotes: 3

Related Questions