title: Getting gen_server/gen_fsm state for debugging
body: <p>Is it possible to obtain the current state of a <code>gen_server</code> process (presumably by sending some system message)? It could be useful when debugging. </p>
  
  <p>Of course, I can add a message which returns the current state to <code>handle_call</code>:</p>
  
  <pre><code>get_state(Server) -&gt; gen_server:call(Server, '$get_state').
  
  %% in every gen_server I want to debug
  ...
  handle_call('$get_state', _From, State) -&gt;
    {reply, State, State};
  ...
  </code></pre>
  
  <p>but is there something built-in (even if it is a bit hacky)?</p>