UP | HOME

2021-03-24

Recon snippets

Table of Contents

Dump stacktrace from all processes

all_stacktrace = :recon_lib.proc_attrs(:current_stacktrace)
seed = DateTime.utc_now() |> DateTime.to_unix() |> Integer.to_string(36)
:file.write_file('/tmp/recon-dump-#{seed}', :io_lib.fwrite('~p.\n', [all_stacktrace]))

Find processes running a given code

Enum.filter(:recon_lib.proc_attrs(:current_stacktrace), fn {pid, stacktrace, _current_fn} ->
  Enum.any?(stacktrace, fn {m, _f, _a, _file_line} ->
    Atom.to_string(m) |> String.downcase() =~ "path_or_file_name"
  end)
end)

Vanshdeep Singh • 2020 • Emacs 26.3 (Org mode 9.3.6)

Dividers Designed by Freepik