File 3473-etp.py-Print-registered-names-for-processes.patch of Package erlang
From 478bec9f16867b28dd4713421d924a40e575af7a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Fri, 9 Apr 2021 06:22:58 +0200
Subject: [PATCH 2/7] etp.py: Print registered names for processes
---
erts/etc/unix/etp.py | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/erts/etc/unix/etp.py b/erts/etc/unix/etp.py
index 56051c68b9..69cb3ba02e 100644
--- a/erts/etc/unix/etp.py
+++ b/erts/etc/unix/etp.py
@@ -72,6 +72,7 @@ def process_info(proc):
print(' Pid: %s' % eterm(proc.GetChildMemberWithName('common').GetChildMemberWithName('id')))
print(' State: %s' % process_state(proc))
print(' Flags: %s' % process_flags(proc))
+ print_process_reg_name(proc)
current = proc.GetChildMemberWithName('current')
if current.unsigned != 0 and proc.GetChildMemberWithName('state').GetChildMemberWithName('counter').unsigned & 0x800 == 0:
print(' Current function: %s' % mfa(current))
@@ -84,6 +85,14 @@ def process_info(proc):
print(' I: %s' % 'unknown')
print(' Pointer: %#x' % proc.unsigned)
+def print_process_reg_name(proc):
+ state = proc.GetChildMemberWithName('state').unsigned
+ if (state & 0x800) == 0:
+ # Not exiting.
+ reg = proc.GetChildMemberWithName('common').GetChildMemberWithName('u').GetChildMemberWithName('alive').GetChildMemberWithName('reg')
+ if reg.unsigned != 0:
+ print(' Registered name: %s' % eterm(reg.GetChildMemberWithName('name')))
+
def process_state(proc):
state = proc.GetChildMemberWithName('state').unsigned
res = ''
--
2.26.2