summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2019-10-15 10:27:25 +0000
committermpi <mpi@openbsd.org>2019-10-15 10:27:25 +0000
commitfa44dea1c190af0c767b553d0d7b503256b4b660 (patch)
tree7994bde3afc3916e83d7d6aae6f70d203c174f38
parentFix db_stack_dump() w/ custom addr & implement db_save_stack_trace(). (diff)
downloadwireguard-openbsd-fa44dea1c190af0c767b553d0d7b503256b4b660.tar.xz
wireguard-openbsd-fa44dea1c190af0c767b553d0d7b503256b4b660.zip
Include the .SUNW_ctf section in bsd.gdb
Once the section has been built from the DWARF symbols also add it to the debug kernel. That makes ddb(4) print the correct number of args in function backtraces in such kernel as well. While here make comment fit in 80 columns. ok jasper@
-rw-r--r--usr.bin/ctfconv/ctfstrip15
1 files changed, 11 insertions, 4 deletions
diff --git a/usr.bin/ctfconv/ctfstrip b/usr.bin/ctfconv/ctfstrip
index f02dc86c37e..9a4eff905bc 100644
--- a/usr.bin/ctfconv/ctfstrip
+++ b/usr.bin/ctfconv/ctfstrip
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $OpenBSD: ctfstrip,v 1.11 2019/05/27 09:31:08 jca Exp $
+# $OpenBSD: ctfstrip,v 1.12 2019/10/15 10:27:25 mpi Exp $
#
# Copyright (c) 2017 Martin Pieuchot
#
@@ -53,12 +53,19 @@ if [ -z "${INFILE##bsd*}" ]; then
LABEL=`what "$INFILE" | sed -n '$s/^ //p'`
fi
-# If ctfstrip was passed a file that lacks useful debug sections, ctfconv will fail.
-# So try to run ctfconv and silently fallback to plain strip(1) if that failed.
+# If ctfstrip was passed a file that lacks useful debug sections, ctfconv will
+# fail. So try to run ctfconv and silently fallback to plain strip(1) if that
+# failed.
ctfconv -o ${TMPFILE} -l "${LABEL}" "${INFILE}" 2> /dev/null
if [ $? -eq 0 ]; then
- objcopy --add-section .SUNW_ctf=${TMPFILE} ${STRIPFLAG} "${INFILE}" ${OUTFILE}
+ objcopy ${STRIPFLAG} \
+ --add-section .SUNW_ctf=${TMPFILE} "${INFILE}" ${OUTFILE}
+
+ # Also add CTF data to the debug kernel
+ if [ -z "${INFILE##bsd.gdb}" ]; then
+ objcopy --add-section .SUNW_ctf=${TMPFILE} "${INFILE}"
+ fi
else
strip ${STRIPFLAG} ${OUTFILE:+"-o${OUTFILE}"} "${INFILE}"
fi