anchor.diff:          false -> Default
       end.
   
  +pad(S, N) ->
  +    genlib_string:pad_string(iolist_to_binary(S), N).
  +
  +padl(S, N) ->
  +    genlib_string:pad_left(iolist_to_binary(S), $\s, N).
  +
   nl() ->
       io_lib:nl().
  
positive.code:         messages,
          message_queue_len,
          current_stacktrace,
          binary
      ],
      case erlang:process_info(P, Items) of
          Info when is_list(Info) ->
              {binary, Binaries} = lists:keyfind(binary, 1, Info),
              [[{pid, P}, {binary_memory, gather_binary_memory(Binaries)} | Info]];
          undefined ->
              []
      end.
  
  gather_binary_memory(Binaries) ->
      lists:foldl(fun({_, Mem, _}, Tot) -> Mem + Tot end, 0, Binaries).
  
  -spec load(file:name()) -> ok | {error, atom()}.
  
  
negative.code:     pid                := Pid,
      registered_name    := RegName,
      status             := Status,
      ancestry           := Ancestry,
      initial_call       := InitialCall,
      memory             := Memory,
      reductions         := Reductions,
      messages           := Messages,
      binary_memory      := Binary,
      current_stacktrace := Stacktrace,
      behaviour          := Behaviour,
      state              := State
  }) ->
      Bl = "   - ",
      Pre = "        ",
      [" * ", format_pidname(Pid, RegName), nl(),
          Bl, "status       : ", to_bin(Status), nl(),
          Bl, "initial call : ", format_call(InitialCall), nl(),
          format_line_opt([Bl, "ancestry     : "], fun format_ancestry/1, Ancestry),
          format_line_opt([Bl, "messagebox   : "], fun (M) -> format_messages(Pre, M) end, Messages),
          Bl, "memory       : ", to_bin(Memory), " bytes", nl(),
          Bl, "binaries     : ", to_bin(Binary), " bytes", nl(),
          Bl, "reductions   : ", to_bin(Reductions), nl(),
          Bl, "stacktrace   : ", nl(), Pre, genlib_format:format_stacktrace(Stacktrace, [newlines]), nl(),
          format_line_opt([Bl, "behaviour    : "], fun format_behaviour/1, Behaviour),
          format_line_opt([Bl], fun (S) -> format_state(Pre, S) end, State)
      ].
  
  format_call({M, F, A}) ->
      [to_bin(M), $:, to_bin(F), $/, to_bin(A)].
  
  format_line_opt(_, _, []) ->
      [];
  format_line_opt(_, _, undefined) ->
      [];
  format_line_opt(Pre, F, List) ->
      [Pre, F(List), nl()].
  
  format_ancestry([E]) ->
      [format_name(E)];
  format_ancestry([E | Rest]) ->
      [format_name(E), " <- ", format_ancestry(Rest)].
  
  format_pidname(Pid, RegName) ->
      [pid_to_list(Pid), $\s, to_bin(RegName)].
  
  format_name(Pid) when is_pid(Pid) ->
      pid_to_list(Pid);
  format_name(Name) when is_atom(Name) ->
      atom_to_binary(Name, utf8).
  
  format_messages(Pre, List) ->
      Sub = lists:sublist(List, 5),
      [nl(),
          [[Pre, genlib:print(M, 100)] || M <- Sub] |
          case List of
              Sub -> [];
              _   -> [Pre, "... and ", to_bin(length(List) - 5), " more"]
          end
      ].
  
  format_behaviour({What, Module}) ->
      [to_bin(What), " (via module: ", to_bin(Module), ")"];
  format_behaviour(What) ->
      to_bin(What).
  
  format_state(Pre, What) ->
      [pad(to_bin(element(1, What)), 12), " : ", nl() | format_state_data(Pre, What)].
  
  format_state_data(Pre, {handlers, Handlers}) ->
      [[Pre, genlib:print(H, 100), nl()] || H <- Handlers];
  format_state_data(Pre, {children, Children}) ->
      [[Pre, format_child(C), nl()] || C <- Children];
  format_state_data(Pre, {state, StateName, Extra}) ->
      [Pre, genlib:print(StateName, 100), nl() | format_state_data(Pre, {state, Extra})];
  format_state_data(Pre, {state, Extra}) ->
      [Pre, genlib:print(Extra, 800), nl()].
  
  format_child({Name, Pid, Type, _}) ->
      [pad(to_bin(Type), 10), " : ", padl(format_sup_pid(Pid), 12), " ", genlib:print(Name, 60)].
  
  format_sup_pid(Special) when is_atom(Special) ->
      [$<, to_bin(Special), $>];
  format_sup_pid(Pid) when is_pid(Pid) ->
      pid_to_list(Pid).
  
  %%
  
  