[Libreoffice-commits] core.git: solenv/bin

Stephan Bergmann sbergman at redhat.com
Wed Jun 21 12:53:12 UTC 2017


 solenv/bin/gdb-core-bt.sh |   37 ++++++++++++++++++++-----------------
 1 file changed, 20 insertions(+), 17 deletions(-)

New commits:
commit 08792a4b332d907c72d1fc7301133f5b306ec8dd
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Jun 21 14:51:49 2017 +0200

    Process all core files that are found
    
    ...which can be useful e.g. when a UITest spawned multiple soffice.bin sub-
    processes that crashed
    
    Change-Id: Ic14ab286b320f2ee548c217e5395cfeec3afa889

diff --git a/solenv/bin/gdb-core-bt.sh b/solenv/bin/gdb-core-bt.sh
index a24390dace2c..45b612128e6f 100755
--- a/solenv/bin/gdb-core-bt.sh
+++ b/solenv/bin/gdb-core-bt.sh
@@ -15,23 +15,26 @@ EXITCODE=${3}
 
 if test -n "$(which gdb)"
 then
-    if test "$(find "$COREDIR" -name "core*" | wc -l)" -eq 1
-    then
-        COREFILE=$(ls "$COREDIR"/core*)
-        echo
-        echo "It looks like ${EXECUTABLE} generated a core file at ${COREFILE}"
-        echo "Backtraces:"
-        GDBCOMMANDFILE=$(mktemp)
-        printf "info registers\nthread apply all backtrace full\n" > "$GDBCOMMANDFILE"
-        guess=$(file "$COREFILE")
-        guess=${guess#* execfn: \'}
-        guess=${guess%%\'*}
-        if [ -x "$guess" ]; then EXECUTABLE=$guess; fi
-        gdb -x "$GDBCOMMANDFILE" --batch "$EXECUTABLE" "$COREFILE"
-        rm "$GDBCOMMANDFILE"
-        echo
-        exit 0
-    elif [ "$EXITCODE" -ge 128 ]; then
+    found=
+    for COREFILE in "$COREDIR"/core*
+    do
+        if [ -f "$COREFILE" ]
+        then
+            printf '\nIt looks like %s generated %s\nBacktraces:\n' \
+                "$EXECUTABLE" "$COREFILE"
+            GDBCOMMANDFILE=$(mktemp)
+            printf "info registers\nthread apply all backtrace full\n" \
+                >"$GDBCOMMANDFILE"
+            guess=$(file "$COREFILE")
+            guess=${guess#* execfn: \'}
+            guess=${guess%%\'*}
+            if [ ! -x "$guess" ]; then guess=$EXECUTABLE; fi
+            gdb -x "$GDBCOMMANDFILE" --batch "$guess" "$COREFILE" && found=x
+            rm "$GDBCOMMANDFILE"
+            echo
+        fi
+    done
+    if [ -z "$found" -a "$EXITCODE" -ge 128 ]; then
         echo
         echo "No core file identified in directory ${COREDIR}"
         echo "To show backtraces for crashes during test execution,"


More information about the Libreoffice-commits mailing list