1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-02-24 17:57:48 +03:00

tests: correcting globbing usage

Ensure globbing uses current dir.
Break loop when no match is found.
Let STACKTRACE finish its output when gdb fails.
This commit is contained in:
Zdenek Kabelac 2017-06-30 14:28:44 +02:00
parent 9348ad4f16
commit 57779e39ec

View File

@ -120,7 +120,7 @@ stacktrace() {
STACKTRACE() {
trap - ERR
local i=0
local i
stacktrace
@ -134,10 +134,12 @@ STACKTRACE() {
echo bt full > gdb_commands.txt
echo l >> gdb_commands.txt
echo quit >> gdb_commands.txt
for core in $(echo core* 2>/dev/null); do
bin=$(gdb -batch -c "$core" 2>&1 | grep "generated by" | \
sed -e "s,.*generated by \`\([^ ']*\).*,\1,")
gdb -batch -c "$core" -x gdb_commands.txt "$(which "$bin")"
# TODO: use sysctl to get 'core' position in system
for i in core*; do
test -f "$i" || break # empty globbing
bin=$(gdb -batch -c "$i" 2>&1 | grep "generated by" | \
sed -e "s,.*generated by \`\([^ ']*\).*,\1,") || continue
gdb -batch -c "$i" -x gdb_commands.txt "$(which "$bin")" || continue
done
fi