Skip site navigation (1)Skip section navigation (2)
Date:      19 Oct 2001 14:38:23 +0200
From:      Dag-Erling Smorgrav <des@ofug.org>
To:        Trent Nelson <nelsont@switch.aust.com>
Cc:        freebsd-arch@FreeBSD.org
Subject:   Re: Proposal: kernel/module debugging support improvements.
Message-ID:  <xzpsncfls8w.fsf@flood.ping.uio.no>
In-Reply-To: <20011019201919.L23852@freebsd06.udt>
References:  <20011019201919.L23852@freebsd06.udt>

next in thread | previous in thread | raw e-mail | index | archive | help
--=-=-=

Trent Nelson <nelsont@switch.aust.com> writes:
>      1. Introducing an ``install.debug'' target to sys/conf/kmod.mk.
> 
>         Advantages of this is it is consistent with the ``install.debug''
>         target already present in the kernel Makefile.  If this approach
>         is to be used -- it's worthwhile to have these present in
>         /usr/src/Makefile.inc1 also.

The install.debug just installs debugging versions alongside the
regular ones (not instead of), but it's "good enough for government
work" if you can afford the space on your root fs (if you can't, use
MODULES_OVERRIDE to limit the number of modules that actually get
built and installed).  I've attached a (lightly tested) patch that
adds an install.debug target to kmod.mk and makes the kernel
Makefile's install.debug and reinstall.debug targets invoke it.  The
only part of the patch I don't like is having to mess with
bsd.subdir.mk, but I don't see any way around it that isn't *more* of
an ugly hack.

One could also add an 'installkernel.debug' target to Makefile.inc1,
but I chose not to do so at this point.

>      2. Introducing ``KERNEL_STRIP'' & ``MODULE_STRIP'' variables.
> 
>         This would be consistent with the ``STRIP'' variable used in the
>         userland build process.  Doing it this way has the disadvantage
>         of introducing two variables whose semantics derive implicitly
>         upon whether or not DEBUG is set.

I'm tempted to suggest that we *always* build the kernel and modules
*with* debugging symbols, and just strip them off at installation time
if we don't want them.  This will have the considerable advantage that
people who experience a difficult-to-reproduce kernel panic but didn't
configure their kernel with -g will still be able to debug the panic
as long as they've kept their kernel build directory around.

DES
-- 
Dag-Erling Smorgrav - des@ofug.org


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment; filename=kmod.diff

Index: share/mk/bsd.subdir.mk
===================================================================
RCS file: /home/ncvs/src/share/mk/bsd.subdir.mk,v
retrieving revision 1.31
diff -u -r1.31 bsd.subdir.mk
--- share/mk/bsd.subdir.mk	27 Mar 2001 08:43:28 -0000	1.31
+++ share/mk/bsd.subdir.mk	19 Oct 2001 11:59:59 -0000
@@ -88,7 +88,8 @@
 
 
 .for __target in all all-man checkdpadd clean cleandepend cleandir depend lint \
-		 maninstall obj objlink regress tags
+		 maninstall obj objlink regress tags \
+		 install.debug reinstall.debug
 .if !target(${__target})
 ${__target}: _SUBDIRUSE
 .endif
Index: sys/conf/kmod.mk
===================================================================
RCS file: /home/ncvs/src/sys/conf/kmod.mk,v
retrieving revision 1.108
diff -u -r1.108 kmod.mk
--- sys/conf/kmod.mk	11 Sep 2001 01:13:49 -0000	1.108
+++ sys/conf/kmod.mk	19 Oct 2001 12:35:21 -0000
@@ -212,6 +212,10 @@
 _INSTALLFLAGS:=	${_INSTALLFLAGS${ie}}
 .endfor
 
+install.debug: _SUBDIR
+	${INSTALL} ${COPY} -o ${KMODOWN} -g ${KMODGRP} -m ${KMODMODE} \
+	    ${_INSTALLFLAGS} ${FULLPROG} ${DESTDIR}${KMODDIR}/
+
 realinstall: _SUBDIR
 	${INSTALL} ${COPY} -o ${KMODOWN} -g ${KMODGRP} -m ${KMODMODE} \
 	    ${_INSTALLFLAGS} ${PROG} ${DESTDIR}${KMODDIR}/
Index: sys/conf/Makefile.alpha
===================================================================
RCS file: /home/ncvs/src/sys/conf/Makefile.alpha,v
retrieving revision 1.113
diff -u -r1.113 Makefile.alpha
--- sys/conf/Makefile.alpha	17 Oct 2001 18:04:13 -0000	1.113
+++ sys/conf/Makefile.alpha	19 Oct 2001 12:17:29 -0000
@@ -339,11 +339,11 @@
 modules-tags:
 	cd $S/modules ; env ${MKMODULESENV} ${MAKE} tags
 
-modules-install modules-install.debug:
+modules-install modules-reinstall:
 	cd $S/modules ; env ${MKMODULESENV} ${MAKE} install
 
-modules-reinstall modules-reinstall.debug:
-	cd $S/modules ; env ${MKMODULESENV} ${MAKE} install
+modules-install.debug modules-reinstall.debug:
+	cd $S/modules ; env ${MKMODULESENV} ${MAKE} install.debug
 
 config.o:
 	${NORMAL_C}
Index: sys/conf/Makefile.i386
===================================================================
RCS file: /home/ncvs/src/sys/conf/Makefile.i386,v
retrieving revision 1.245
diff -u -r1.245 Makefile.i386
--- sys/conf/Makefile.i386	17 Oct 2001 13:57:32 -0000	1.245
+++ sys/conf/Makefile.i386	19 Oct 2001 12:18:03 -0000
@@ -297,11 +297,11 @@
 modules-tags:
 	cd $S/modules ; env ${MKMODULESENV} ${MAKE} tags
 
-modules-install modules-install.debug:
+modules-install modules-reinstall:
 	cd $S/modules ; env ${MKMODULESENV} ${MAKE} install
 
-modules-reinstall modules-reinstall.debug:
-	cd $S/modules ; env ${MKMODULESENV} ${MAKE} install
+modules-install.debug modules-reinstall.debug:
+	cd $S/modules ; env ${MKMODULESENV} ${MAKE} install.debug
 
 config.o:
 	${NORMAL_C}
Index: sys/conf/Makefile.ia64
===================================================================
RCS file: /home/ncvs/src/sys/conf/Makefile.ia64,v
retrieving revision 1.36
diff -u -r1.36 Makefile.ia64
--- sys/conf/Makefile.ia64	17 Oct 2001 18:04:13 -0000	1.36
+++ sys/conf/Makefile.ia64	19 Oct 2001 12:18:03 -0000
@@ -307,11 +307,11 @@
 modules-tags:
 	cd $S/modules ; env ${MKMODULESENV} ${MAKE} tags
 
-modules-install modules-install.debug:
+modules-install modules-reinstall:
 	cd $S/modules ; env ${MKMODULESENV} ${MAKE} install
 
-modules-reinstall modules-reinstall.debug:
-	cd $S/modules ; env ${MKMODULESENV} ${MAKE} install
+modules-install.debug modules-reinstall.debug:
+	cd $S/modules ; env ${MKMODULESENV} ${MAKE} install.debug
 
 config.o:
 	${NORMAL_C}
Index: sys/conf/Makefile.pc98
===================================================================
RCS file: /home/ncvs/src/sys/conf/Makefile.pc98,v
retrieving revision 1.146
diff -u -r1.146 Makefile.pc98
--- sys/conf/Makefile.pc98	17 Oct 2001 18:04:13 -0000	1.146
+++ sys/conf/Makefile.pc98	19 Oct 2001 12:18:03 -0000
@@ -301,11 +301,11 @@
 modules-tags:
 	cd $S/modules ; env ${MKMODULESENV} ${MAKE} tags
 
-modules-install modules-install.debug:
+modules-install modules-reinstall:
 	cd $S/modules ; env ${MKMODULESENV} ${MAKE} install
 
-modules-reinstall modules-reinstall.debug:
-	cd $S/modules ; env ${MKMODULESENV} ${MAKE} install
+modules-install.debug modules-reinstall.debug:
+	cd $S/modules ; env ${MKMODULESENV} ${MAKE} install.debug
 
 config.o:
 	${NORMAL_C}
Index: sys/conf/Makefile.powerpc
===================================================================
RCS file: /home/ncvs/src/sys/conf/Makefile.powerpc,v
retrieving revision 1.251
diff -u -r1.251 Makefile.powerpc
--- sys/conf/Makefile.powerpc	19 Oct 2001 00:32:00 -0000	1.251
+++ sys/conf/Makefile.powerpc	19 Oct 2001 12:18:03 -0000
@@ -307,11 +307,11 @@
 modules-tags:
 	cd $S/modules ; env ${MKMODULESENV} ${MAKE} tags
 
-modules-install modules-install.debug:
+modules-install modules-reinstall:
 	cd $S/modules ; env ${MKMODULESENV} ${MAKE} install
 
-modules-reinstall modules-reinstall.debug:
-	cd $S/modules ; env ${MKMODULESENV} ${MAKE} install
+modules-install.debug modules-reinstall.debug:
+	cd $S/modules ; env ${MKMODULESENV} ${MAKE} install.debug
 
 config.o:
 	${NORMAL_C}
Index: sys/conf/Makefile.sparc64
===================================================================
RCS file: /home/ncvs/src/sys/conf/Makefile.sparc64,v
retrieving revision 1.5
diff -u -r1.5 Makefile.sparc64
--- sys/conf/Makefile.sparc64	17 Oct 2001 18:04:13 -0000	1.5
+++ sys/conf/Makefile.sparc64	19 Oct 2001 12:18:03 -0000
@@ -311,11 +311,11 @@
 modules-tags:
 	cd $S/modules ; env ${MKMODULESENV} ${MAKE} tags
 
-modules-install modules-install.debug:
+modules-install modules-reinstall:
 	cd $S/modules ; env ${MKMODULESENV} ${MAKE} install
 
-modules-reinstall modules-reinstall.debug:
-	cd $S/modules ; env ${MKMODULESENV} ${MAKE} install
+modules-install.debug modules-reinstall.debug:
+	cd $S/modules ; env ${MKMODULESENV} ${MAKE} install.debug
 
 config.o:
 	${NORMAL_C}

--=-=-=--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?xzpsncfls8w.fsf>