Skip to content

@on_load and @on_definition callbacks do not emit trace events #14427

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

Closed
lukaszsamson opened this issue Apr 11, 2025 · 1 comment
Closed

@on_load and @on_definition callbacks do not emit trace events #14427

lukaszsamson opened this issue Apr 11, 2025 · 1 comment

Comments

@lukaszsamson
Copy link
Contributor

lukaszsamson commented Apr 11, 2025

Elixir and Erlang/OTP versions

Erlang/OTP 27 [erts-15.2.5] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit]

Elixir 1.18.3 (compiled with Erlang/OTP 27)

Operating system

any

Current behavior

With an example tracer

defmodule MyTracer do
  def trace(event, env) do
    dbg({env.file, env.line})
    dbg(event)
    :ok
  end
end
Code.put_compiler_option(:tracers, [MyTracer])

compile example code from https://hexdocs.pm/elixir/1.18.3/Module.html#module-on_definition and https://hexdocs.pm/elixir/1.18.3/Module.html#module-on_load

No traces for the functions given in @on_load and @on_definition attributes are emitted.

Expected behavior

I would expect @on_load to emit :local_function (or :remote_function) and @on_definition to emit :remote_function events. @before_compile, @after_compile and @after_verify correctly emit :remote_(function|macro)

@josevalim
Copy link
Member

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants