File 4251-Add-cerl-rr-eplay.patch of Package erlang

From 0217a88db8b4daa1f6cefe3278a858913db4db1e Mon Sep 17 00:00:00 2001
From: Sverker Eriksson <sverker@erlang.org>
Date: Mon, 19 Jun 2023 20:28:33 +0200
Subject: [PATCH 1/2] Add cerl -rr eplay

---
 erts/etc/unix/cerl.src | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/erts/etc/unix/cerl.src b/erts/etc/unix/cerl.src
index 8046cee347..05deeea3e3 100644
--- a/erts/etc/unix/cerl.src
+++ b/erts/etc/unix/cerl.src
@@ -47,6 +47,8 @@
 #   -icount	Run emulator compiled for instruction counting
 #   -rr         Run emulator under "rr record"
 #               Can be combined with compile targets (like -debug) except valgrind.
+#   -rr replay|eplay [rr-replay-options]
+#               Run "rr replay" without or with emacs
 #   -nox        Unset the DISPLAY variable to disable us of X Windows
 #
 # FIXME For GDB you can also set the break point using "-break FUNCTION".
@@ -252,7 +254,7 @@ while [ $# -gt 0 ]; do
 	    cargs="$cargs -rr"
 	    run_rr=yes
             case "$1" in
-                "replay"|"ps")
+                "replay"|"eplay"|"ps")
                     ;;
                 *)
 	            skip_erlexec=yes
@@ -399,18 +401,24 @@ if [ "x$GDB" = "x" ]; then
             exec $taskset1 valgrind $valgrind_xml $valgrind_log $vgflags $BINDIR/$EMU_NAME $sched_arg $emu_xargs "$@"
         fi
     elif [ $run_rr = yes ]; then
-        if [ $1 = replay ]; then
+        if [ $1 = replay ] || [ $1 = eplay ]; then
+	    rr_cmd=$1
 
             install_gdb_tools
 
             shift
             cmdfile="/tmp/.cerlgdb.$$"
             echo "set \$etp_beam_executable = \"$BINDIR/$EMU_NAME\"" > $cmdfile
             if [ "$1" = "-p" ]; then
                 echo 'set $etp_rr_run_until_beam = 1' >> $cmdfile
             fi
-            cat $ROOTDIR/erts/etc/unix/etp-commands >> $cmdfile
-            exec rr replay -x $cmdfile $*
+	    echo "source $ROOTDIR/erts/etc/unix/etp-commands" >> $cmdfile
+            if [ $rr_cmd = replay ]; then
+		exec rr replay -x $cmdfile $*
+	    else
+		# eplay
+		exec emacs -eval "(progn (gdb \"rr replay -i=mi -x $cmdfile $*\"))"
+	    fi
         elif [ $1 = ps ]; then
             shift
             rr ps $* | head -1
-- 
2.35.3

openSUSE Build Service is sponsored by