echo l
echo quit
} > gdb_commands.txt
- # TODO: use sysctl to get 'core' position in system
- for i in core*; do
- test -f "$i" || break # empty globbing
+
+ # Check for all cores newer then TESTNAME file
+ # Assume users keep prefix 'core'
+ while IFS= read -r i; do
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
+ echo "## Checking coredump: $i generated by $bin."
+ gdb -batch -c "$i" -x gdb_commands.txt "$(which "$bin")" 2>/dev/null | \
+ sed -e "s,^,## GDB: ," || continue
+ done < <(find . $(dirname $(sysctl -n kernel.core_pattern)) -name 'core*' -newer TESTNAME 2>/dev/null || true)
fi
test -f SKIP_THIS_TEST && exit 200