Giter Site home page Giter Site logo

Comments (4)

nietaki avatar nietaki commented on May 30, 2024

Here's some preliminary research on what the print function gets:

iex(2)> pf = fn(t) ->
...(2)> IO.puts "term:"
...(2)> IO.inspect t
...(2)> end
#Function<6.118419387/1 in :erl_eval.expr/5>
iex(3)> opts = [print_fun: pf]

iex(4)> Rexbug.start("URI.parse/1", opts)
{82, 1}
iex(5)> URI.parse("https://example.com")
term:
{:call, {{URI, :parse, ["https://example.com"]}, ""},
 {#PID<0.150.0>, {IEx.Evaluator, :init, 4}}, {21, 49, 20, 152927}}
%URI{authority: "example.com", fragment: nil, host: "example.com", path: nil,
 port: 443, query: nil, scheme: "https", userinfo: nil}
redbug done, timeout - 1

iex(7)> Rexbug.start("URI.parse/1 :: return", opts)
{82, 1}
iex(8)> URI.parse("https://example.com")
term:
{:call, {{URI, :parse, ["https://example.com"]}, ""},
 {#PID<0.150.0>, {IEx.Evaluator, :init, 4}}, {21, 50, 9, 106586}}
%URI{authority: "example.com", fragment: nil, host: "example.com", path: nil,
 port: 443, query: nil, scheme: "https", userinfo: nil}
term:
{:retn,
 {{URI, :parse, 1},
  %URI{authority: "example.com", fragment: nil, host: "example.com", path: nil,
   port: 443, query: nil, scheme: "https", userinfo: nil}},
 {#PID<0.150.0>, {IEx.Evaluator, :init, 4}}, {21, 50, 9, 106655}}
redbug done, timeout - 1

iex(12)> Rexbug.start("URI.parse/1 :: stack", opts)
{82, 1}
iex(13)> spawn fn() -> URI.parse("https://example.com") end
term:
#PID<0.187.0>
{:call,
 {{URI, :parse, ["https://example.com"]},
  "=proc:<0.187.0>\nState: Running\nSpawned as: erlang:apply/2\nLast scheduled in for: erlang:apply/2\nSpawned by: <0.150.0>\nStarted: Wed Feb  7 21:52:42 2018\nMessage queue length: 0\nNumber of heap fragments: 0\nHeap fragment data: 0\nReductions: 0\nStack+heap: 233\nOldHeap: 0\nHeap unused: 21\nOldHeap unused: 0\nMemory: 2704\nStack dump:\nProgram counter: 0x0000000016adace0 (unknown function)\nCP: 0x0000000016adace8 (<terminate process normally>)\nInternal State: ACT_PRIO_NORMAL | USR_PRIO_NORMAL | PRQ_PRIO_NORMAL | ACTIVE | RUNNING | ON_HEAP_MSGQ\n"},
 {#PID<0.187.0>, :dead}, {21, 52, 42, 71458}}
redbug done, timeout - 1
iex(14)> Rexbug.start("URI.parse/1 :: stack,return", opts)
{82, 1}
iex(15)> spawn fn() -> URI.parse("https://example.com") end
#PID<0.194.0>
term:
{:call,
 {{URI, :parse, ["https://example.com"]},
  "=proc:<0.194.0>\nState: Running\nSpawned as: erlang:apply/2\nLast scheduled in for: erlang:apply/2\nSpawned by: <0.150.0>\nStarted: Wed Feb  7 21:53:07 2018\nMessage queue length: 0\nNumber of heap fragments: 0\nHeap fragment data: 0\nReductions: 0\nStack+heap: 233\nOldHeap: 0\nHeap unused: 21\nOldHeap unused: 0\nMemory: 2704\nStack dump:\nProgram counter: 0x0000000016adace0 (unknown function)\nCP: 0x0000000016adace8 (<terminate process normally>)\nInternal State: ACT_PRIO_NORMAL | USR_PRIO_NORMAL | PRQ_PRIO_NORMAL | ACTIVE | RUNNING | ON_HEAP_MSGQ\n"},
 {#PID<0.194.0>, :dead}, {21, 53, 7, 178108}}
term:
{:retn,
 {{URI, :parse, 1},
  %URI{authority: "example.com", fragment: nil, host: "example.com", path: nil,
   port: 443, query: nil, scheme: "https", userinfo: nil}},
 {#PID<0.194.0>, :dead}, {21, 53, 7, 178179}}
redbug done, timeout - 1

iex(18)> Rexbug.start(:send, [procs: :new] ++ opts)
{0, 0}
term:
{:send,
 {{:io_request, #PID<0.210.0>, #Reference<0.0.2.1324>,
   {:get_line, :unicode, "iex(19)> "}}, {#PID<0.50.0>, {:group, :server, 3}}},
 {#PID<0.210.0>, {:erlang, :apply, 2}}, {21, 59, 39, 113386}}
iex(19)> spawn fn() -> send(self(), :wat) end
term:
{:send,
 {{:input, #PID<0.210.0>, "spawn fn() -> send(self(), :wat) end\n"},
  {#PID<0.51.0>, {:erlang, :apply, 2}}}, {#PID<0.210.0>, :dead},
 {21, 59, 42, 769092}}
#PID<0.211.0>
term:
{:send, {:wat, {#PID<0.211.0>, :dead}}, {#PID<0.211.0>, :dead},
 {21, 59, 42, 769563}}
term:
{:send,
 {{:io_request, #PID<0.212.0>, #Reference<0.0.1.70>,
   {:get_line, :unicode, "iex(20)> "}}, {#PID<0.50.0>, {:group, :server, 3}}},
 {#PID<0.212.0>, {:erlang, :apply, 2}}, {21, 59, 42, 769809}}
redbug done, timeout - 4

iex(22)> Rexbug.start(:receive, opts)
term:
{82, 0}
{:recv, {:running, 82, 0}, {#PID<0.150.0>, {IEx.Evaluator, :init, 4}},
 {22, 3, 29, 89757}}
term:
{:recv,
 {:io_request, #PID<0.150.0>, #Reference<0.0.1.78>, {:get_geometry, :columns}},
 {#PID<0.50.0>, {:group, :server, 3}}, {22, 3, 29, 89833}}

from rexbug.

nietaki avatar nietaki commented on May 30, 2024

and stacks, brace for it

iex(25)> g = fn() -> :ets.all() end
#Function<20.118419387/0 in :erl_eval.expr/5>
iex(26)> g.()

% 22:20:22 <0.150.0>({'Elixir.IEx.Evaluator',init,4})
% ets:all()
[69665, :httpc_hex__handler_db, :httpc_hex__session_db, :hex_version, 65565,
 :httpc_manager__handler_db, :httpc_manager__session_db, 61466, 57369, 53272,
 40983, 36886, :ssl_pem_cache, 45076, 49171, IEx.Config, :elixir_modules,
 :elixir_config, :file_io_servers, :inet_hosts_file_byaddr,
 :inet_hosts_file_byname, :inet_hosts_byaddr, :inet_hosts_byname, :inet_cache,
 :inet_db, :global_pid_ids, :global_pid_names, :global_names_ext, :global_names,
 :global_locks, 4098, 1, :ac_tab]
  proc_lib:init_p_do_apply/3
  'Elixir.IEx.Evaluator':init/4
  'Elixir.IEx.Evaluator':loop/3
  'Elixir.IEx.Evaluator':eval/4
  'Elixir.IEx.Evaluator':do_eval/4
  'Elixir.IEx.Evaluator':handle_eval/6
  elixir:eval_forms/4
  elixir:erl_eval/3

% 22:20:22 <0.150.0>({'Elixir.IEx.Evaluator',init,4})
% ets:all/0 -> [69665,httpc_hex__handler_db,httpc_hex__session_db,hex_version,
                65565,httpc_manager__handler_db,httpc_manager__session_db,
                61466,57369,53272,40983,36886,ssl_pem_cache,45076,49171,
                'Elixir.IEx.Config',elixir_modules,elixir_config,
                file_io_servers,inet_hosts_file_byaddr,inet_hosts_file_byname,
                inet_hosts_byaddr,inet_hosts_byname,inet_cache,inet_db,
                global_pid_ids,global_pid_names,global_names_ext,global_names,
                global_locks,4098,1,ac_tab]
redbug done, timeout - 1
iex(27)> Rexbug.start(":ets.all() :: stack,return", opts)
{82, 1}
iex(28)> g.()
term:
[69665, :httpc_hex__handler_db, :httpc_hex__session_db, :hex_version, 65565,
 :httpc_manager__handler_db, :httpc_manager__session_db, 61466, 57369, 53272,
 40983, 36886, :ssl_pem_cache, 45076, 49171, IEx.Config, :elixir_modules,
 :elixir_config, :file_io_servers, :inet_hosts_file_byaddr,
 :inet_hosts_file_byname, :inet_hosts_byaddr, :inet_hosts_byname, :inet_cache,
 :inet_db, :global_pid_ids, :global_pid_names, :global_names_ext, :global_names,
 :global_locks, 4098, 1, :ac_tab]
{:call,
 {{:ets, :all, []},
  "=proc:<0.150.0>\nState: Running\nSpawned as: proc_lib:init_p/5\nLast scheduled in for: ets:all/0\nSpawned by: <0.51.0>\nStarted: Wed Feb  7 21:45:50 2018\nMessage queue length: 0\nNumber of heap fragments: 0\nHeap fragment data: 0\nLink list: [{from,<0.51.0>,#Ref<0.0.7.3>}]\nDictionary: [{iex_history,\#{'__struct__'=>'Elixir.IEx.History.State',queue=>{[{27,\"Rexbug.start(\\\":ets.all() :: stack,return\\\", opts)\\n\",{82,1}},{26,\"g.()\\n\",[69665,httpc_hex__handler_db,httpc_hex__session_db,hex_version,65565,httpc_manager__handler_db,httpc_manager__session_db,61466,57369,53272,40983,36886,ssl_pem_cache,45076,49171,'Elixir.IEx.Config',elixir_modules,elixir_config,file_io_servers,inet_hosts_file_byaddr,inet_hosts_file_byname,inet_hosts_byaddr,inet_hosts_byname,inet_cache,inet_db,global_pid_ids,global_pid_names,global_names_ext,global_names,global_locks,4098,1,ac_tab]},{25,\"g = fn() -> :ets.all() end\\n\",#Fun<erl_eval.20.118419387>},{24,\"Rexbug.start(\\\":ets.all() :: stack,return\\\")\\n\",{82,1}},{23,\"g = fn() -> :ets.all() end\\n\",#Fun<erl_eval.20.118419387>},{22,\"Rexbug.start(:receive, opts)\\n\",{82,0}},{21,\"Rexbug.start(:receive, opts)\\n\",redbug_already_started},{20,\"Rexbug.start(:receive, [procs: :new] ++ opts)\\n\",{0,0}},{19,\"spawn fn() -> send(self(), :wat) end\\n\",<0.211.0>},{18,\"Rexbug.start(:send, [procs: :new] ++ opts)\\n\",{0,0}},{17,\"Rexbug.start(:send, opts)\\n\",{82,0}},{16,\"spawn fn() -> send(self(), :wat) end\\n\",<0.196.0>},{15,\"spawn fn() -> URI.parse(\\\"https://example.com\\\") end\\n\",<0.194.0>},{14,\"Rexbug.start(\\\"URI.parse/1 :: stack,return\\\", opts)\\n\",{82,1}},{13,\"spawn fn() -> URI.parse(\\\"https://example.com\\\") end\\n\",<0.187.0>},{12,\"Rexbug.start(\\\"URI.parse/1 :: stack\\\", opts)\\n\",{82,1}},{11,\"spawn fn() -> URI.parse(\\\"https://example.com\\\") end\\n\",<0.180.0>}],[{8,\"URI.parse(\\\"https://example.com\\\")\\n\",\#{'__struct__'=>'Elixir.URI',authority=><<\"example.com\">>,fragment=>nil,host=><<\"example.com\">>,path=>nil,port=>443,query=>nil,scheme=><<\"https\">>,userinfo=>nil}},{9,\"Rexbug.start(\\\"URI.parse/1 :: stack\\\", opts)\\n\",{82,1}},{10,\"URI.parse(\\\"https://example.com\\\")\\n\",\#{'__struct__'=>'Elixir.URI',authority=><<\"example.com\">>,fragment=>nil,host=><<\"example.com\">>,path=>nil,port=>443,query=>nil,scheme=><<\"https\">>,userinfo=>nil}}]},size=>27,start=>8}},{'$ancestors',[<0.51.0>]},{'$initial_call',{'Elixir.IEx.Evaluator',init,4}}]\nReductions: 62411\nStack+heap: 1598\nOldHeap: 6772\nHeap unused: 665\nOldHeap unused: 2236\nMemory: 67960\nStack dump:\nProgram counter: 0x00000000188f7f58 (unknown function)\nCP: 0x000000001761ed48 (erl_eval:do_apply/6 + 560)\n\n0x0000000018a904c0 Return addr 0x0000000019b89388 (elixir:erl_eval/3 + 496)\ny(0)     [{'_@0',#Fun<erl_eval.20.118419387>},{'_@1',[{print_fun,#Fun<erl_eval.6.118419387>}]},{'_@2',#Fun<erl_eval.6.118419387>}]\ny(1)     []\n\n0x0000000018a904d8 Return addr 0x0000000019b89038 (elixir:eval_forms/4 + 600)\ny(0)     []\ny(1)     []\ny(2)     Catch 0x0000000019b893a8 (elixir:erl_eval/3 + 528)\n\n0x0000000018a904f8 Return addr 0x00000000175d3300 ('Elixir.IEx.Evaluator':handle_eval/6 + 1312)\ny(0)     []\ny(1)     {elixir_scope,nil,nil,false,false,nil,nil,\#{{g,nil}=>{'_@0',0,true},{opts,nil}=>{'_@1',0,true},{pf,nil}=>{'_@2',0,true}},nil,nil,nil,nil,\#{'_'=>3},<<\"iex\">>}\ny(2)     \#{'__struct__'=>'Elixir.Macro.Env',aliases=>[],context=>nil,context_modules=>[],export_vars=>nil,file=><<\"iex\">>,function=>nil,functions=>[{'Elixir.IEx.Helpers',[{c,1},{c,2},{cd,1},{clear,0},{flush,0},{h,0},{i,1},{l,1},{ls,0},{ls,1},{nl,1},{nl,2},{pid,1},{pid,3},{pwd,0},{r,1},{recompile,0},{respawn,0},{v,0},{v,1}]},{'Elixir.Kernel',[{'!=',2},{'!==',2},{'*',2},{'+',1},{'+',2},{'++',2},{'-',1},{'-',2},{'--',2},{'/',2},{'<',2},{'<=',2},{'==',2},{'===',2},{'=~',2},{'>',2},{'>=',2},{abs,1},{apply,2},{apply,3},{binary_part,3},{bit_size,1},{byte_size,1},{div,2},{elem,2},{exit,1},{'function_exported?',3},{get_and_update_in,3},{get_in,2},{hd,1},{inspect,1},{inspect,2},{is_atom,1},{is_binary,1},{is_bitstring,1},{is_boolean,1},{is_float,1},{is_function,1},{is_function,2},{is_integer,1},{is_list,1},{is_map,1},{is_number,1},{is_pid,1},{is_port,1},{is_reference,1},{is_tuple,1},{length,1},{'macro_exported?',3},{make_ref,0},{map_size,1},{max,2},{min,2},{node,0},{node,1},{not,1},{pop_in,2},{put_elem,3},{put_in,3},{rem,2},{round,1},{self,0},{send,2},{spawn,1},{spawn,3},{spawn_link,1},{spawn_link,3},{spawn_monitor,1},{spawn_monitor,3},{struct,1},{struct,2},{'struct!',1},{'struct!',2},{throw,1},{tl,1},{trunc,1},{tuple_size,1},{update_in,3}]}],lexical_tracker=>nil,line=>1,macro_aliases=>[],macros=>[{'Elixir.IEx.Helpers',[{b,1},{h,1},{import_file,1},{import_file,2},{import_file_if_available,1},{import_if_available,1},{import_if_available,2},{s,1},{t,1}]},{'Elixir.Kernel',[{'!',1},{'&&',2},{'..',2},{'<>',2},{'@',1},{'alias!',1},{and,2},{binding,0},{binding,1},{def,1},{def,2},{defdelegate,2},{defexception,1},{defimpl,2},{defimpl,3},{defmacro,1},{defmacro,2},{defmacrop,1},{defmacrop,2},{defmodule,2},{defoverridable,1},{defp,1},{defp,2},{defprotocol,2},{defstruct,1},{destructure,2},{get_and_update_in,2},{if,2},{in,2},{is_nil,1},{'match?',2},{or,2},{pop_in,1},{put_in,2},{raise,1},{raise,2},{reraise,2},{reraise,3},{sigil_C,2},{sigil_D,2},{sigil_N,2},{sigil_R,2},{sigil_S,2},{sigil_T,2},{sigil_W,2},{sigil_c,2},{sigil_r,2},{sigil_s,2},{sigil_w,2},{to_char_list,1},{to_charlist,1},{to_string,1},{unless,2},{update_in,2},{use,1},{use,2},{'var!',1},{'var!',2},{'|>',2},{'||',2}]}],module=>nil,requires=>['Elixir.IEx.Helpers','Elixir.Kernel','Elixir.Kernel.Typespec'],vars=>[{g,nil},{opts,nil},{pf,nil}]}\n\n0x0000000018a90518 Return addr 0x00000000175d2018 ('Elixir.IEx.Evaluator':do_eval/4 + 2064)\ny(0)     []\ny(1)     []\ny(2)     []\ny(3)     []\ny(4)     \#{binding=>[{g,#Fun<erl_eval.20.118419387>},{opts,[{print_fun,#Fun<erl_eval.6.118419387>}]},{pf,#Fun<erl_eval.6.118419387>}],env=>\#{'__struct__'=>'Elixir.Macro.Env',aliases=>[],context=>nil,context_modules=>[],export_vars=>nil,file=><<\"iex\">>,function=>nil,functions=>[{'Elixir.IEx.Helpers',[{c,1},{c,2},{cd,1},{clear,0},{flush,0},{h,0},{i,1},{l,1},{ls,0},{ls,1},{nl,1},{nl,2},{pid,1},{pid,3},{pwd,0},{r,1},{recompile,0},{respawn,0},{v,0},{v,1}]},{'Elixir.Kernel',[{'!=',2},{'!==',2},{'*',2},{'+',1},{'+',2},{'++',2},{'-',1},{'-',2},{'--',2},{'/',2},{'<',2},{'<=',2},{'==',2},{'===',2},{'=~',2},{'>',2},{'>=',2},{abs,1},{apply,2},{apply,3},{binary_part,3},{bit_size,1},{byte_size,1},{div,2},{elem,2},{exit,1},{'function_exported?',3},{get_and_update_in,3},{get_in,2},{hd,1},{inspect,1},{inspect,2},{is_atom,1},{is_binary,1},{is_bitstring,1},{is_boolean,1},{is_float,1},{is_function,1},{is_function,2},{is_integer,1},{is_list,1},{is_map,1},{is_number,1},{is_pid,1},{is_port,1},{is_reference,1},{is_tuple,1},{length,1},{'macro_exported?',3},{make_ref,0},{map_size,1},{max,2},{min,2},{node,0},{node,1},{not,1},{pop_in,2},{put_elem,3},{put_in,3},{rem,2},{round,1},{self,0},{send,2},{spawn,1},{spawn,3},{spawn_link,1},{spawn_link,3},{spawn_monitor,1},{spawn_monitor,3},{struct,1},{struct,2},{'struct!',1},{'struct!',2},{throw,1},{tl,1},{trunc,1},{tuple_size,1},{update_in,3}]}],lexical_tracker=>nil,line=>1,macro_aliases=>[],macros=>[{'Elixir.IEx.Helpers',[{b,1},{h,1},{import_file,1},{import_file,2},{import_file_if_available,1},{import_if_available,1},{import_if_available,2},{s,1},{t,1}]},{'Elixir.Kernel',[{'!',1},{'&&',2},{'..',2},{'<>',2},{'@',1},{'alias!',1},{and,2},{binding,0},{binding,1},{def,1},{def,2},{defdelegate,2},{defexception,1},{defimpl,2},{defimpl,3},{defmacro,1},{defmacro,2},{defmacrop,1},{defmacrop,2},{defmodule,2},{defoverridable,1},{defp,1},{defp,2},{defprotocol,2},{defstruct,1},{destructure,2},{get_and_update_in,2},{if,2},{in,2},{is_nil,1},{'match?',2},{or,2},{pop_in,1},{put_in,2},{raise,1},{raise,2},{reraise,2},{reraise,3},{sigil_C,2},{sigil_D,2},{sigil_N,2},{sigil_R,2},{sigil_S,2},{sigil_T,2},{sigil_W,2},{sigil_c,2},{sigil_r,2},{sigil_s,2},{sigil_w,2},{to_char_list,1},{to_charlist,1},{to_string,1},{unless,2},{update_in,2},{use,1},{use,2},{'var!',1},{'var!',2},{'|>',2},{'||',2}]}],module=>nil,requires=>['Elixir.IEx.Helpers','Elixir.Kernel','Elixir.Kernel.Typespec'],vars=>[{g,nil},{opts,nil},{pf,nil}]},scope=>{elixir_scope,nil,nil,false,false,nil,nil,\#{{g,nil}=>{'_@0',0,true},{opts,nil}=>{'_@1',0,true},{pf,nil}=>{'_@2',0,true}},nil,nil,nil,nil,\#{'_'=>3},<<\"iex\">>}}\ny(5)     \#{'__struct__'=>'Elixir.IEx.History.State',queue=>{[{27,\"Rexbug.start(\\\":ets.all() :: stack,return\\\", opts)\\n\",{82,1}},{26,\"g.()\\n\",[69665,httpc_hex__handler_db,httpc_hex__session_db,hex_version,65565,httpc_manager__handler_db,httpc_manager__session_db,61466,57369,53272,40983,36886,ssl_pem_cache,45076,49171,'Elixir.IEx.Config',elixir_modules,elixir_config,file_io_servers,inet_hosts_file_byaddr,inet_hosts_file_byname,inet_hosts_byaddr,inet_hosts_byname,inet_cache,inet_db,global_pid_ids,global_pid_names,global_names_ext,global_names,global_locks,4098,1,ac_tab]},{25,\"g = fn() -> :ets.all() end\\n\",#Fun<erl_eval.20.118419387>},{24,\"Rexbug.start(\\\":ets.all() :: stack,return\\\")\\n\",{82,1}},{23,\"g = fn() -> :ets.all() end\\n\",#Fun<erl_eval.20.118419387>},{22,\"Rexbug.start(:receive, opts)\\n\",{82,0}},{21,\"Rexbug.start(:receive, opts)\\n\",redbug_already_started},{20,\"Rexbug.start(:receive, [procs: :new] ++ opts)\\n\",{0,0}},{19,\"spawn fn() -> send(self(), :wat) end\\n\",<0.211.0>},{18,\"Rexbug.start(:send, [procs: :new] ++ opts)\\n\",{0,0}},{17,\"Rexbug.start(:send, opts)\\n\",{82,0}},{16,\"spawn fn() -> send(self(), :wat) end\\n\",<0.196.0>},{15,\"spawn fn() -> URI.parse(\\\"https://example.com\\\") end\\n\",<0.194.0>},{14,\"Rexbug.start(\\\"URI.parse/1 :: stack,return\\\", opts)\\n\",{82,1}},{13,\"spawn fn() -> URI.parse(\\\"https://example.com\\\") end\\n\",<0.187.0>},{12,\"Rexbug.start(\\\"URI.parse/1 :: stack\\\", opts)\\n\",{82,1}},{11,\"spawn fn() -> URI.parse(\\\"https://example.com\\\") end\\n\",<0.180.0>}],[{8,\"URI.parse(\\\"https://example.com\\\")\\n\",\#{'__struct__'=>'Elixir.URI',authority=><<\"example.com\">>,fragment=>nil,host=><<\"example.com\">>,path=>nil,port=>443,query=>nil,scheme=><<\"https\">>,userinfo=>nil}},{9,\"Rexbug.start(\\\"URI.parse/1 :: stack\\\", opts)\\n\",{82,1}},{10,\"URI.parse(\\\"https://example.com\\\")\\n\",\#{'__struct__'=>'Elixir.URI',authority=><<\"example.com\">>,fragment=>nil,host=><<\"example.com\">>,path=>nil,port=>443,query=>nil,scheme=><<\"https\">>,userinfo=>nil}}]},size=>27,start=>8}\ny(6)     \#{'__struct__'=>'Elixir.IEx.State',cache=>[],counter=>28,prefix=><<\"iex\">>}\ny(7)     28\ny(8)     \"g.()\\n\"\n\n0x0000000018a90568 Return addr 0x00000000175d2148 ('Elixir.IEx.Evaluator':eval/4 + 120)\ny(0)     []\ny(1)     []\ny(2)     []\ny(3)     []\ny(4)     []\ny(5)     Catch 0x00000000175d2058 ('Elixir.IEx.Evaluator':do_eval/4 + 2128)\n\n0x0000000018a905a0 Return addr 0x00000000175d3f70 ('Elixir.IEx.Evaluator':loop/3 + 464)\ny(0)     []\ny(1)     \#{binding=>[{g,#Fun<erl_eval.20.118419387>},{opts,[{print_fun,#Fun<erl_eval.6.118419387>}]},{pf,#Fun<erl_eval.6.118419387>}],env=>\#{'__struct__'=>'Elixir.Macro.Env',aliases=>[],context=>nil,context_modules=>[],export_vars=>nil,file=><<\"iex\">>,function=>nil,functions=>[{'Elixir.IEx.Helpers',[{c,1},{c,2},{cd,1},{clear,0},{flush,0},{h,0},{i,1},{l,1},{ls,0},{ls,1},{nl,1},{nl,2},{pid,1},{pid,3},{pwd,0},{r,1},{recompile,0},{respawn,0},{v,0},{v,1}]},{'Elixir.Kernel',[{'!=',2},{'!==',2},{'*',2},{'+',1},{'+',2},{'++',2},{'-',1},{'-',2},{'--',2},{'/',2},{'<',2},{'<=',2},{'==',2},{'===',2},{'=~',2},{'>',2},{'>=',2},{abs,1},{apply,2},{apply,3},{binary_part,3},{bit_size,1},{byte_size,1},{div,2},{elem,2},{exit,1},{'function_exported?',3},{get_and_update_in,3},{get_in,2},{hd,1},{inspect,1},{inspect,2},{is_atom,1},{is_binary,1},{is_bitstring,1},{is_boolean,1},{is_float,1},{is_function,1},{is_function,2},{is_integer,1},{is_list,1},{is_map,1},{is_number,1},{is_pid,1},{is_port,1},{is_reference,1},{is_tuple,1},{length,1},{'macro_exported?',3},{make_ref,0},{map_size,1},{max,2},{min,2},{node,0},{node,1},{not,1},{pop_in,2},{put_elem,3},{put_in,3},{rem,2},{round,1},{self,0},{send,2},{spawn,1},{spawn,3},{spawn_link,1},{spawn_link,3},{spawn_monitor,1},{spawn_monitor,3},{struct,1},{struct,2},{'struct!',1},{'struct!',2},{throw,1},{tl,1},{trunc,1},{tuple_size,1},{update_in,3}]}],lexical_tracker=>nil,line=>1,macro_aliases=>[],macros=>[{'Elixir.IEx.Helpers',[{b,1},{h,1},{import_file,1},{import_file,2},{import_file_if_available,1},{import_if_available,1},{import_if_available,2},{s,1},{t,1}]},{'Elixir.Kernel',[{'!',1},{'&&',2},{'..',2},{'<>',2},{'@',1},{'alias!',1},{and,2},{binding,0},{binding,1},{def,1},{def,2},{defdelegate,2},{defexception,1},{defimpl,2},{defimpl,3},{defmacro,1},{defmacro,2},{defmacrop,1},{defmacrop,2},{defmodule,2},{defoverridable,1},{defp,1},{defp,2},{defprotocol,2},{defstruct,1},{destructure,2},{get_and_update_in,2},{if,2},{in,2},{is_nil,1},{'match?',2},{or,2},{pop_in,1},{put_in,2},{raise,1},{raise,2},{reraise,2},{reraise,3},{sigil_C,2},{sigil_D,2},{sigil_N,2},{sigil_R,2},{sigil_S,2},{sigil_T,2},{sigil_W,2},{sigil_c,2},{sigil_r,2},{sigil_s,2},{sigil_w,2},{to_char_list,1},{to_charlist,1},{to_string,1},{unless,2},{update_in,2},{use,1},{use,2},{'var!',1},{'var!',2},{'|>',2},{'||',2}]}],module=>nil,requires=>['Elixir.IEx.Helpers','Elixir.Kernel','Elixir.Kernel.Typespec'],vars=>[{g,nil},{opts,nil},{pf,nil}]},scope=>{elixir_scope,nil,nil,false,false,nil,nil,\#{{g,nil}=>{'_@0',0,true},{opts,nil}=>{'_@1',0,true},{pf,nil}=>{'_@2',0,true}},nil,nil,nil,nil,\#{'_'=>3},<<\"iex\">>}}\ny(2)     \#{'__struct__'=>'Elixir.IEx.History.State',queue=>{[{27,\"Rexbug.start(\\\":ets.all() :: stack,return\\\", opts)\\n\",{82,1}},{26,\"g.()\\n\",[69665,httpc_hex__handler_db,httpc_hex__session_db,hex_version,65565,httpc_manager__handler_db,httpc_manager__session_db,61466,57369,53272,40983,36886,ssl_pem_cache,45076,49171,'Elixir.IEx.Config',elixir_modules,elixir_config,file_io_servers,inet_hosts_file_byaddr,inet_hosts_file_byname,inet_hosts_byaddr,inet_hosts_byname,inet_cache,inet_db,global_pid_ids,global_pid_names,global_names_ext,global_names,global_locks,4098,1,ac_tab]},{25,\"g = fn() -> :ets.all() end\\n\",#Fun<erl_eval.20.118419387>},{24,\"Rexbug.start(\\\":ets.all() :: stack,return\\\")\\n\",{82,1}},{23,\"g = fn() -> :ets.all() end\\n\",#Fun<erl_eval.20.118419387>},{22,\"Rexbug.start(:receive, opts)\\n\",{82,0}},{21,\"Rexbug.start(:receive, opts)\\n\",redbug_already_started},{20,\"Rexbug.start(:receive, [procs: :new] ++ opts)\\n\",{0,0}},{19,\"spawn fn() -> send(self(), :wat) end\\n\",<0.211.0>},{18,\"Rexbug.start(:send, [procs: :new] ++ opts)\\n\",{0,0}},{17,\"Rexbug.start(:send, opts)\\n\",{82,0}},{16,\"spawn fn() -> send(self(), :wat) end\\n\",<0.196.0>},{15,\"spawn fn() -> URI.parse(\\\"https://example.com\\\") end\\n\",<0.194.0>},{14,\"Rexbug.start(\\\"URI.parse/1 :: stack,return\\\", opts)\\n\",{82,1}},{13,\"spawn fn() -> URI.parse(\\\"https://example.com\\\") end\\n\",<0.187.0>},{12,\"Rexbug.start(\\\"URI.parse/1 :: stack\\\", opts)\\n\",{82,1}},{11,\"spawn fn() -> URI.parse(\\\"https://example.com\\\") end\\n\",<0.180.0>}],[{8,\"URI.parse(\\\"https://example.com\\\")\\n\",\#{'__struct__'=>'Elixir.URI',authority=><<\"example.com\">>,fragment=>nil,host=><<\"example.com\">>,path=>nil,port=>443,query=>nil,scheme=><<\"https\">>,userinfo=>nil}},{9,\"Rexbug.start(\\\"URI.parse/1 :: stack\\\", opts)\\n\",{82,1}},{10,\"URI.parse(\\\"https://example.com\\\")\\n\",\#{'__struct__'=>'Elixir.URI',authority=><<\"example.com\">>,fragment=>nil,host=><<\"example.com\">>,path=>nil,port=>443,query=>nil,scheme=><<\"https\">>,userinfo=>nil}}]},size=>27,start=>8}\ny(3)     \#{'__struct__'=>'Elixir.IEx.State',cache=>[],counter=>28,prefix=><<\"iex\">>}\ny(4)     Catch 0x00000000175d2168 ('Elixir.IEx.Evaluator':eval/4 + 152)\n\n0x0000000018a905d0 Return addr 0x00000000175d3928 ('Elixir.IEx.Evaluator':init/4 + 544)\ny(0)     []\ny(1)     []\ny(2)     []\ny(3)     []\ny(4)     []\ny(5)     []\ny(6)     <0.51.0>\n\n0x0000000018a90610 Return addr 0x000000001762f360 (proc_lib:init_p_do_apply/3 + 56)\ny(0)     <0.50.0>\ny(1)     Catch 0x00000000175d3970 ('Elixir.IEx.Evaluator':init/4 + 616)\ny(2)     []\ny(3)     []\n\n0x0000000018a90638 Return addr 0x0000000016adace8 (<terminate process normally>)\ny(0)     Catch 0x000000001762f380 (proc_lib:init_p_do_apply/3 + 88)\nInternal State: ACT_PRIO_NORMAL | USR_PRIO_NORMAL | PRQ_PRIO_NORMAL | ACTIVE | RUNNING | ON_HEAP_MSGQ\n"},
 {#PID<0.150.0>, {IEx.Evaluator, :init, 4}}, {22, 21, 4, 723619}}
term:
{:retn,
 {{:ets, :all, 0},
  [69665, :httpc_hex__handler_db, :httpc_hex__session_db, :hex_version, 65565,
   :httpc_manager__handler_db, :httpc_manager__session_db, 61466, 57369, 53272,
   40983, 36886, :ssl_pem_cache, 45076, 49171, IEx.Config, :elixir_modules,
   :elixir_config, :file_io_servers, :inet_hosts_file_byaddr,
   :inet_hosts_file_byname, :inet_hosts_byaddr, :inet_hosts_byname, :inet_cache,
   :inet_db, :global_pid_ids, :global_pid_names, :global_names_ext,
   :global_names, :global_locks, 4098, 1, :ac_tab]},
 {#PID<0.150.0>, {IEx.Evaluator, :init, 4}}, {22, 21, 4, 723648}}
redbug done, timeout - 1

from rexbug.

nietaki avatar nietaki commented on May 30, 2024

https://github.com/massemanet/redbug/blob/master/src/redbug.erl#L407-L427 - this is how I think redbug does it

from rexbug.

nietaki avatar nietaki commented on May 30, 2024

This looks simple and viable: https://github.com/liveforeverx/exrun/blob/master/lib/tracer/formatter.ex#L34-L39

from rexbug.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.