Fix system test backtrace generation on OpenBSD

On Linux core dump contains absolute path to crashed binary

    Core was generated by `/home/newman/isc/ws/bind9/bin/named/.libs/lt-named -D glue-ns1 -X named.lock -m'.

However, on OpenBSD there's only a basename

    Core was generated by `named'.

This commit adds support for the latter, retains the former.
This commit is contained in:
Michal Nowak 2020-10-19 13:33:32 +02:00
parent f8de3df76c
commit f0b13873a3
No known key found for this signature in database
GPG key ID: 24A3E8463AEE5E56

View file

@ -265,7 +265,10 @@ if [ -n "$core_dumps" ]; then
export SYSTESTDIR="$systest"
echoinfo "D:$systest:backtrace from $coredump:"
echoinfo "D:$systest:--------------------------------------------------------------------------------"
binary=$(gdb --batch --core="$coredump" 2>/dev/null | sed -ne "s/Core was generated by \`//;s/ .*'.$//p;")
binary=$(gdb --batch --core="$coredump" 2>/dev/null | sed -ne "s|Core was generated by \`\([^' ]*\)[' ].*|\1|p")
if [ ! -f "${binary}" ]; then
binary=$(find "${top_builddir}" -path "*/.libs/${binary}" -type f)
fi
"${top_builddir}/libtool" --mode=execute gdb \
-batch \
-ex bt \