Index: etc/Makefile =================================================================== --- etc/Makefile +++ etc/Makefile @@ -143,16 +143,13 @@ # -rwxr-xr-x root:wheel, for the new cron root:wheel BIN2= netstart pccard_ether rc.suspend rc.resume -MTREE= BSD.include.dist BSD.root.dist BSD.usr.dist BSD.var.dist +MTREE= BSD.debug.dist BSD.include.dist BSD.root.dist BSD.usr.dist BSD.var.dist .if ${MK_TESTS} != "no" MTREE+= BSD.tests.dist .endif .if ${MK_SENDMAIL} != "no" MTREE+= BSD.sendmail.dist .endif -.if ${MK_DEBUG_FILES} != "no" -MTREE+= BSD.debug.dist -.endif PPPCNF= ppp.conf Index: etc/mtree/BSD.debug.dist =================================================================== --- etc/mtree/BSD.debug.dist +++ etc/mtree/BSD.debug.dist @@ -9,6 +9,8 @@ bin .. boot + kernel + .. .. lib geom Index: share/man/man7/hier.7 =================================================================== --- share/man/man7/hier.7 +++ share/man/man7/hier.7 @@ -380,6 +380,8 @@ .It Pa aout/ a.out backward compatibility libraries .El +.It Pa debug/ +standalone debug data for the kernel and base system userland .It Pa dtrace/ DTrace library scripts .It Pa engines/ Index: sys/conf/kern.post.mk =================================================================== --- sys/conf/kern.post.mk +++ sys/conf/kern.post.mk @@ -101,11 +101,11 @@ .if !defined(DEBUG) FULLKERNEL= ${KERNEL_KO} .else -FULLKERNEL= ${KERNEL_KO}.debug -${KERNEL_KO}: ${FULLKERNEL} ${KERNEL_KO}.symbols - ${OBJCOPY} --strip-debug --add-gnu-debuglink=${KERNEL_KO}.symbols\ +FULLKERNEL= ${KERNEL_KO}.full +${KERNEL_KO}: ${FULLKERNEL} ${KERNEL_KO}.debug + ${OBJCOPY} --strip-debug --add-gnu-debuglink=${KERNEL_KO}.debug \ ${FULLKERNEL} ${.TARGET} -${KERNEL_KO}.symbols: ${FULLKERNEL} +${KERNEL_KO}.debug: ${FULLKERNEL} ${OBJCOPY} --only-keep-debug ${FULLKERNEL} ${.TARGET} install.debug reinstall.debug: gdbinit cd ${.CURDIR}; ${MAKE} ${.TARGET:R} @@ -154,7 +154,7 @@ kernel-clean: rm -f *.o *.so *.So *.ko *.s eddep errs \ - ${FULLKERNEL} ${KERNEL_KO} ${KERNEL_KO}.symbols \ + ${FULLKERNEL} ${KERNEL_KO} ${KERNEL_KO}.debug \ linterrs tags vers.c \ vnode_if.c vnode_if.h vnode_if_newproto.h vnode_if_typedef.h \ ${MFILES:T:S/.m$/.c/} ${MFILES:T:S/.m$/.h/} \ @@ -252,19 +252,26 @@ if [ ! "`dirname "$$thiskernel"`" -ef ${DESTDIR}${KODIR} ] ; then \ chflags -R noschg ${DESTDIR}${KODIR} ; \ rm -rf ${DESTDIR}${KODIR} ; \ + rm -rf ${DESTDIR}${DEBUGDIR}${KODIR} ; \ else \ if [ -d ${DESTDIR}${KODIR}.old ] ; then \ chflags -R noschg ${DESTDIR}${KODIR}.old ; \ rm -rf ${DESTDIR}${KODIR}.old ; \ fi ; \ mv ${DESTDIR}${KODIR} ${DESTDIR}${KODIR}.old ; \ + if [ -n "${DEBUGDIR}" -a \ + -d ${DESTDIR}${DEBUGDIR}${KODIR} ]; then \ + rm -rf ${DESTDIR}${DEBUGDIR}${KODIR}.old ; \ + mv ${DESTDIR}${DEBUGDIR}${KODIR} ${DESTDIR}${DEBUGDIR}${KODIR}.old ; \ + fi ; \ sysctl kern.bootfile=${DESTDIR}${KODIR}.old/"`basename "$$thiskernel"`" ; \ fi .endif mkdir -p ${DESTDIR}${KODIR} ${INSTALL} -p -m 555 -o ${KMODOWN} -g ${KMODGRP} ${KERNEL_KO} ${DESTDIR}${KODIR} .if defined(DEBUG) && !defined(INSTALL_NODEBUG) && ${MK_KERNEL_SYMBOLS} != "no" - ${INSTALL} -p -m 555 -o ${KMODOWN} -g ${KMODGRP} ${KERNEL_KO}.symbols ${DESTDIR}${KODIR} + mkdir -p ${DESTDIR}${DEBUGDIR}${KODIR} + ${INSTALL} -p -m 555 -o ${KMODOWN} -g ${KMODGRP} ${KERNEL_KO}.debug ${DESTDIR}${DEBUGDIR}${KODIR} .endif .if defined(KERNEL_EXTRA_INSTALL) ${INSTALL} -p -m 555 -o ${KMODOWN} -g ${KMODGRP} ${KERNEL_EXTRA_INSTALL} ${DESTDIR}${KODIR} @@ -276,7 +283,7 @@ @-chflags -R noschg ${DESTDIR}${KODIR} ${INSTALL} -p -m 555 -o ${KMODOWN} -g ${KMODGRP} ${KERNEL_KO} ${DESTDIR}${KODIR} .if defined(DEBUG) && !defined(INSTALL_NODEBUG) && ${MK_KERNEL_SYMBOLS} != "no" - ${INSTALL} -p -m 555 -o ${KMODOWN} -g ${KMODGRP} ${KERNEL_KO}.symbols ${DESTDIR}${KODIR} + ${INSTALL} -p -m 555 -o ${KMODOWN} -g ${KMODGRP} ${KERNEL_KO}.debug ${DESTDIR}${DEBUGDIR}${KODIR} .endif config.o env.o hints.o vers.o vnode_if.o: Index: sys/conf/kmod.mk =================================================================== --- sys/conf/kmod.mk +++ sys/conf/kmod.mk @@ -169,11 +169,11 @@ .if !defined(DEBUG_FLAGS) FULLPROG= ${PROG} .else -FULLPROG= ${PROG}.debug -${PROG}: ${FULLPROG} ${PROG}.symbols - ${OBJCOPY} --strip-debug --add-gnu-debuglink=${PROG}.symbols\ +FULLPROG= ${PROG}.full +${PROG}: ${FULLPROG} ${PROG}.debug + ${OBJCOPY} --strip-debug --add-gnu-debuglink=${PROG}.debug \ ${FULLPROG} ${.TARGET} -${PROG}.symbols: ${FULLPROG} +${PROG}.debug: ${FULLPROG} ${OBJCOPY} --only-keep-debug ${FULLPROG} ${.TARGET} .endif @@ -268,7 +268,7 @@ CLEANFILES+= ${PROG} ${KMOD}.kld ${OBJS} .if defined(DEBUG_FLAGS) -CLEANFILES+= ${FULLPROG} ${PROG}.symbols +CLEANFILES+= ${FULLPROG} ${PROG}.debug .endif .if !target(install) @@ -286,7 +286,7 @@ ${_INSTALLFLAGS} ${PROG} ${DESTDIR}${KMODDIR} .if defined(DEBUG_FLAGS) && !defined(INSTALL_NODEBUG) && ${MK_KERNEL_SYMBOLS} != "no" ${INSTALL} -o ${KMODOWN} -g ${KMODGRP} -m ${KMODMODE} \ - ${_INSTALLFLAGS} ${PROG}.symbols ${DESTDIR}${KMODDIR} + ${_INSTALLFLAGS} ${PROG}.debug ${DESTDIR}${DEBUGDIR}${KMODDIR} .endif .include