How to show Erlang call stack?

前端 未结 4 808
耶瑟儿~
耶瑟儿~ 2021-02-14 18:06

I need to debug some module in foreign system. The module has public function foo() - how can I know place (module and function name) from which foo() given module

4条回答
  •  闹比i
    闹比i (楼主)
    2021-02-14 18:42

    io:format("~s~n", [element(2, process_info(self(), backtrace))]).
    

    self() can be replaced by any other pid (rpc:pinfo should even work with remote procs). This helps if you cannot even modify the source or beam.

提交回复
热议问题