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

Also supporting :dbg.fun2ms/1 ? #20

Closed
sinorga opened this issue Aug 24, 2018 · 0 comments · Fixed by #22
Closed

Also supporting :dbg.fun2ms/1 ? #20

sinorga opened this issue Aug 24, 2018 · 0 comments · Fixed by #22

Comments

@sinorga
Copy link

sinorga commented Aug 24, 2018

Hi,
First of all, thanks for the nice libraray. 😄

I am playing around the :dbg module in Elixir recently. I noticed I can't use the builtin match_spec functions with :dbg.fun2ms/1 in Elixir. So will this library plans to support it too?
Example:

iex(13)> :dbg.fun2ms(fn(_) -> return_trace() end)
** (CompileError) iex:13: undefined function return_trace/0
    (elixir) src/elixir_fn.erl:21: anonymous fn/3 in :elixir_fn.expand/3
    (stdlib) lists.erl:1239: :lists.map/2
    (elixir) src/elixir_fn.erl:26: :elixir_fn.expand/3

So my workaround is using atom as function and warpping the tuple manualy of :dbg.fun2ms/1 output.

iex(13)> :dbg.fun2ms(fn(_) -> :return_trace end)
[{:_, [], [:return_trace]}]
iex(14)> # Wrapping the ruple [{:_, [], [{:return_trace}]}]

But it quite inconvenient.
I'm wondering if I used it in the wrong way or people use match spec directly without this kind of helper functions. I can't find related topics about this issue. I only saw Elixir is going to Deprecate usage of parse_transforms(elixir-lang/elixir#5762) and point to here. so I think maybe here is the right place to ask the question. 😄

chrismcg added a commit to chrismcg/ex2ms that referenced this issue May 3, 2019
The Match Specification in Erlang documentation has a list of
ActionFunction's that can be used in the body when creating match
specifications for tracing functions for use in :erlang.trace_pattern/3.

http://erlang.org/doc/apps/erts/match_spec.html

This adds support for those functions so tracing match specifications
can be constructed using Ex2ms.

Closes ericmj#20
ericmj pushed a commit that referenced this issue May 12, 2019
The Match Specification in Erlang documentation has a list of
ActionFunction's that can be used in the body when creating match
specifications for tracing functions for use in :erlang.trace_pattern/3.

http://erlang.org/doc/apps/erts/match_spec.html

This adds support for those functions so tracing match specifications
can be constructed using Ex2ms.

Closes #20
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

Successfully merging a pull request may close this issue.

1 participant