tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Modules and debug info



On Tue, Dec 27, 2011 at 01:22:29PM +1100, matthew green wrote:
> 
> is the debug info stored anywhere?
> 
> i don't object to the change for installed modules (infact,
> i'm quite sure we want to do that) but it would be nice if
> the debug info itself was kept somewhere.  that could be a
> followup change or a filed PR..

That reminds me the attached patch i use on my -current NetBSD/amd64
machines where MKDEBUG is turned on.

-- 
Nicolas Joly

Projects and Developments in Bioinformatics
Institut Pasteur, Paris.
Index: share/mk/bsd.kmodule.mk
===================================================================
RCS file: /cvsroot/src/share/mk/bsd.kmodule.mk,v
retrieving revision 1.33
diff -u -p -r1.33 bsd.kmodule.mk
--- share/mk/bsd.kmodule.mk     11 Sep 2011 18:38:03 -0000      1.33
+++ share/mk/bsd.kmodule.mk     27 Dec 2011 22:36:53 -0000
@@ -72,6 +72,14 @@ KMODSCRIPT=  ${DESTDIR}/usr/libdata/ldscr
 OBJS+=         ${SRCS:N*.h:N*.sh:R:S/$/.o/g}
 PROG?=         ${KMOD}.kmod
 
+.if ${MKDEBUG} != "no"
+KMODDEBUG=     mv ${PROG} ${PROG}.gdb && \
+               ${STRIP} --strip-debug -o ${PROG} ${PROG}.gdb
+CLEANFILES+=   ${PROG}.gdb
+.else
+KMODDEBUG=     true
+.endif
+
 ##### Build rules
 realall:       ${PROG}
 
@@ -81,6 +89,7 @@ ${PROG}: ${OBJS} ${DPADD}
        ${_MKTARGET_LINK}
        ${CC} ${LDFLAGS} -nostdlib -r -Wl,-T,${KMODSCRIPT},-d \
                -o ${.TARGET} ${OBJS}
+       ${KMODDEBUG}
 
 ##### Install rules
 .if !target(kmodinstall)
@@ -113,7 +122,7 @@ ${_PROG}:   .MADE                                   # no 
build at instal
        done
        ${INSTALL_DIR} ${KMODULEDIR}
        ${INSTALL_FILE} -o ${KMODULEOWN} -g ${KMODULEGRP} -m ${KMODULEMODE} \
-               ${.ALLSRC} ${.TARGET}
+               ${STRIPFLAG} ${.ALLSRC} ${.TARGET}
 
 kmodinstall::  ${_PROG}
 .PHONY:                kmodinstall


Home | Main Index | Thread Index | Old Index