[erlang-questions] Simple wrapper around dbg?

Kenneth Lundin kenneth.lundin@REDACTED
Tue Nov 6 18:27:22 CET 2012


The parse transform is already written for you, see
http://www.erlang.org/documentation/doc-5.2/lib/stdlib-1.11.0/doc/html/ms_transform.html

/Kenneth , Erlang/OTP Ericsson
Den 6 nov 2012 15:33 skrev "Attila Rajmund Nohl" <attila.r.nohl@REDACTED>:

> Hello!
>
> I can trace a function call with specific arguments with a command like
> this:
>
> dbg:tpl(foo, bar, dbg:fun2ms(fun([baz,_]) -> return_trace(),
> exception_trace() end)).
>
> However, it's a long to type, I'd like to have a wrapper around it.
> The naive solution doesn't even compile:
>
> -module(d).
>
> -export([mfa/3]).
>
> mfa(M, F, A) ->
>     dbg:tpl(M, F, dbg:fun2ms(fun(Args) when Args==A -> return_trace(),
> exception_trace() end)).
>
> because there are no return_trace() and exception_trace() functions in
> the module. Even if it'd compile, I couldn't call it like this:
>
> d:mfa(foo, bar, [baz, _]).
>
> because the _ variable is not bound. Is there a simple workaround or
> shall I start to read up on parse_transforms?
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20121106/781889e3/attachment.htm>


More information about the erlang-questions mailing list