[PATCH] cerl: prevent gdb hang at prompt

Michael Santos michael.santos@REDACTED
Tue Oct 5 22:46:44 CEST 2010


On Ubuntu 10.04 with emacs versions 22 and 23, gdb hangs at the prompt
after being started. Change the load order and, for v23, use a command
line switch to set annotation mode.
---
 erts/etc/unix/cerl.src |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/erts/etc/unix/cerl.src b/erts/etc/unix/cerl.src
index 9dab9fc..de34ffc 100644
--- a/erts/etc/unix/cerl.src
+++ b/erts/etc/unix/cerl.src
@@ -65,6 +65,7 @@ cxargs_add() {
 core=
 
 GDB=
+GDBARGS=
 GDBBP=
 TYPE=
 EMU_TYPE=
@@ -277,9 +278,15 @@ else
 	    ;;
     esac
 
+    gdbcmd="$gdbcmd $GDBBP \
+            (insert-string \"source $ROOTDIR/erts/etc/unix/etp-commands\") \
+            (comint-send-input)"
+
     # Set annotation level for gdb in emacs 22 and higher.
     emacs_major=`$EMACS --version | head -1 | sed 's,^[^0-9]*\([0-9]*\).*,\1,g'`
-    if [ '!' -z "$emacs_major" -a $emacs_major -gt 21 ]; then
+    if [ '!' -z "$emacs_major" -a $emacs_major -gt 22 ]; then
+    GDBARGS="--annotate=3"
+    elif [ '!' -z "$emacs_major" -a $emacs_major -gt 21 ]; then
 	# Hack - wait for etp-commands to be loaded and then set
 	# annotation level, could be done more beautifully than with sit-for...
 	gdbcmd="$gdbcmd \
@@ -287,9 +294,6 @@ else
                 (insert-string \"set annotate 3\") \
                 (comint-send-input)"
     fi
-    gdbcmd="$gdbcmd $GDBBP \
-            (insert-string \"source $ROOTDIR/erts/etc/unix/etp-commands\") \
-            (comint-send-input)"
     # Fire up gdb in emacs...
-    exec $EMACS --eval "(progn (gdb \"gdb $EMU\") $gdbcmd)"
+    exec $EMACS --eval "(progn (gdb \"gdb $GDBARGS $EMU\") $gdbcmd)"
 fi
-- 
1.7.0.4



More information about the erlang-patches mailing list