File 0902-erts-Fix-etp-heapdump-to-work-with-funs-binaries-and.patch of Package erlang

From 07ee69b5ac07d0e85d6bf1270e47edbc175ea7eb Mon Sep 17 00:00:00 2001
From: Lukas Larsson <lukas@erlang.org>
Date: Mon, 7 Feb 2022 17:40:04 +0100
Subject: [PATCH 1/2] erts: Fix etp-heapdump to work with funs, binaries and
 maps

---
 erts/etc/unix/etp-commands.in | 39 +++++++++++++++++++++++++++--------
 1 file changed, 30 insertions(+), 9 deletions(-)

diff --git a/erts/etc/unix/etp-commands.in b/erts/etc/unix/etp-commands.in
index 43810c8046..18e52f2b37 100644
--- a/erts/etc/unix/etp-commands.in
+++ b/erts/etc/unix/etp-commands.in
@@ -2147,24 +2147,45 @@ define etp-term-dump-pid
 end
 
 define etp-term-dump-header
-# Args: Header term
+  # Args: Header term
   if (($arg0) & 0x3f) == 0
-    printf  "| H:%4d-tuple ", ($arg0) >> 6
+    printf  "| H:%4u-tuple ", ($arg0) >> 6
   else
     set $etp_heapdump_skips = ($arg0) >> 6
     if ((($arg0) & 0x3f) == 0x18)
-      printf  "| H: float %3d ", ($arg0) >> 6
+      printf  "| H: float %3u ", ($arg0) >> 6
     else
       if ((($arg0) & 0x3f) == 0x28)
-        # sub-binary
         printf  "| H:   sub-bin "
       else
-        if ((($arg0) & 0x3f) == 0x8)
-          # pos-bignum
-          printf  "| H:bignum %3u ", ($arg0) >> 6
+        if ((($arg0) & 0x3f) == 0x24)
+          printf  "| H:  heap-bin "
         else
-          printf  "| header %5d ", ($arg0) >> 6
-	end
+          if ((($arg0) & 0x3f) == 0x20)
+            printf  "| H:  refc-bin "
+          else
+            if ((($arg0) & 0x3f) == 0x8)
+              # pos-bignum
+              printf  "| H:bignum %3u ", ($arg0) >> 6
+            else
+              if ((($arg0) & 0x3f) == 0x14)
+                printf  "| H:fun %6u ", ($arg0) >> 6
+              else
+                if ((($arg0) & 0xbc) == 0x3c)
+                  set $etp_heapdump_skips = (($arg0)>>(6+2)) & 0xff
+                  printf  "| flatmap %5u ", $etp_heapdump_skips
+                else
+                  if ((($arg0) & 0xbc) == 0xbc)
+                    set $etp_heapdump_skips = (($arg0)>>(6+2)) & 0xff
+                    printf  "| hashmap %4u ", $etp_heapdump_skips
+                  else
+                    printf  "| header %5u ", ($arg0) >> 6
+                  end
+                end
+              end
+	    end
+          end
+        end
       end
     end
   end
-- 
2.34.1

openSUSE Build Service is sponsored by