~dbpercona/percona-qa/readme

340.1.1 by Roel Van de Paar
Adding analyze_subdir_cores.sh which can be used after running test_mysqld_options.sh
1
#!/bin/bash
2
# Created by Roel Van de Paar, Percona LLC
3
4
# This script analyzes core files in subdirectories and writes output to gdb_<core file name>_STD/_FULL.txt
5
6
if [ "$1" == "" ]; then
7
  echo "This script analyzes core files in subdirectories and writes output to gdb_<core file name>_STD/_FULL.txt."
8
  echo "It expects one parameter: a full path pointer to the binary used to generate these core dumps. For example:"
9
  echo "$ cd my_work_dir; <your_percona-qa_path>/analyze_subdir_cores.sh /ssd/Percona-Server-5.6.14-rel62.0-508-debug.Linux.x86_64/bin/mysqld"
10
  exit 1
11
else
12
  BIN=$1
13
fi
14
15
for CORE in $(find . | grep "core.*") ; do
16
  # For debugging purposes, remove ">/dev/null 2>&1" on the next line and observe output
17
  COREFILE=$(echo $CORE | sed 's|data.\([0-9]*\).|core_data.\1_|' | sed 's|.*core|core|')
18
  gdb ${BIN} ${CORE} >/dev/null 2>&1 <<EOF
19
    # Avoids libary loading issues / more manual work, see bash$ info "(gdb)Auto-loading safe path"
20
    set auto-load safe-path /         
21
    # See http://sourceware.org/gdb/onlinedocs/gdb/Threads.html - this avoids the following issue:
22
    # "warning: unable to find libthread_db matching inferior's threadlibrary, thread debugging will not be available"
23
    set libthread-db-search-path /usr/lib/
24
    set trace-commands on
25
    set pagination off
26
    set print pretty on
27
    set print array on
28
    set print array-indexes on
29
    set print elements 4096
30
    set logging file gdb_${COREFILE}_FULL.txt
31
    set logging on
32
    thread apply all bt full
33
    set logging off
34
    set logging file gdb_${COREFILE}_STD.txt
35
    set logging on
36
    thread apply all bt
37
    set logging off
38
    quit
39
EOF
40
done;
41
42
echo "Done!"
43
echo "P.S. To quickly check what the cores are for, use:"
44
echo 'grep -A 20 "Thread 1 (" *_STD.txt | grep "#[4-6]" | egrep -v "assert|abort"'