diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-06-21 14:51:49 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-06-21 14:51:49 +0200 |
commit | 08792a4b332d907c72d1fc7301133f5b306ec8dd (patch) | |
tree | c292ec98eb547e5ace32701b960cdb06e75a6021 /solenv | |
parent | d7824bf16898d8cb776420e0c2bff82e6df61b86 (diff) |
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
Diffstat (limited to 'solenv')
-rwxr-xr-x | solenv/bin/gdb-core-bt.sh | 37 |
1 files changed, 20 insertions, 17 deletions
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," |