Getting gen_server/gen_fsm state for debugging

Is it possible to obtain the current state of a gen_server process (presumably by sending some system message)? It could be useful when debugging.

Of course, I can add a message which returns the current state to handle_call:

get_state(Server) -> gen_server:call(Server, '$get_state').

%% in every gen_server I want to debug
...
handle_call('$get_state', _From, State) ->
  {reply, State, State};
...

but is there something built-in (even if it is a bit hacky)?

11
задан Alexey Romanov 22 November 2010 в 22:31
поделиться