diff --git a/lib/stdlib/src/c.erl b/lib/stdlib/src/c.erl index d6da6513dbd7..152deb6509c0 100644 --- a/lib/stdlib/src/c.erl +++ b/lib/stdlib/src/c.erl @@ -672,11 +672,22 @@ mfa_string(X) -> w(X). display_info(Pid) -> - case pinfo(Pid, [initial_call, current_function, reductions, message_queue_len, - heap_size, stack_size, registered_name, - {dictionary, '$process_description'}, - {dictionary, '$initial_call'}]) - of + PInfo0 = pinfo(Pid, [initial_call, current_function, reductions, message_queue_len, + heap_size, stack_size, registered_name, + {dictionary, '$process_description'}, + {dictionary, '$initial_call'}]), + PInfo = case PInfo0 of + PInfo0 when is_list(PInfo0) -> + PInfo0; + {badrpc, {'EXIT', {badarg, _}}} -> + patch_old_pinfo(pinfo(Pid, [initial_call, current_function, + reductions, message_queue_len, + heap_size, stack_size, registered_name, + dictionary])); + _ -> + undefined + end, + case PInfo of undefined -> {0,0,0,0}; Info -> Call = initial_call(Info), @@ -753,6 +764,13 @@ pinfo(Pid, What) -> false -> process_info(Pid, What) end. +patch_old_pinfo(undefined) -> + undefined; +patch_old_pinfo(KeyList0) -> + {value, {dictionary, Dict}, KeyList} = lists:keytake(dictionary, 1, KeyList0), + PD = proplists:get_value('$process_description', Dict, undefined), + IC = proplists:get_value('$initial_call', Dict, undefined), + [{'$process_description', PD}, {'$initial_call', IC} | KeyList]. fetch(Key, Info) -> case lists:keyfind(Key, 1, Info) of