David Taylor
2007-Dec-31 15:04 UTC
[PATCH] 7-STABLE Build broken in geom_io.c with KTR but no DDB
Hi, I've been trying to do some debugging with ktrace(9) for the first time, and ran in to a problem after trying to compile the kernel. I didn't have DDB defined, and as a result the build failed after adding "option KTR": geom_io.o(.text+0x5ee): In function `g_alloc_bio': ../../../geom/geom_io.c:140: undefined reference to `stack_save' geom_io.o(.text+0x61e):../../../geom/geom_io.c:141: undefined reference to `stack_ktr' geom_io.o(.text+0x6e1): In function `g_clone_bio': The use of CTRx in the geom code appears to be correctly wrapped with #ifdef KTR, but this is also all that protects the uses of CTRSTACK. CTRSTACK is also defined to use stack_ktr conditionally on #ifdef KTR in sys/stack.h, but the stack_ktr function is compiled in to the kernel only if DDB is enabled. Perhaps CTRSTACK should be non-empty only if both DDB and KTR are defined? -- David Taylor -------------- next part -------------- A non-text attachment was scrubbed... Name: sys_stack_h.diff Type: text/x-diff Size: 614 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20071231/bc6f6a9a/sys_stack_h.bin
David Taylor
2007-Dec-31 16:50 UTC
[PATCH] 7-STABLE Build broken in geom_io.c with KTR but no DDB
On Mon, 31 Dec 2007, David Taylor wrote:> Hi, > > I've been trying to do some debugging with ktrace(9) for the first time, > and ran in to a problem after trying to compile the kernel. > > I didn't have DDB defined, and as a result the build failed > after adding "option KTR": > > geom_io.o(.text+0x5ee): In function `g_alloc_bio': > ../../../geom/geom_io.c:140: undefined reference to `stack_save' > geom_io.o(.text+0x61e):../../../geom/geom_io.c:141: undefined reference to `stack_ktr' > geom_io.o(.text+0x6e1): In function `g_clone_bio': > > The use of CTRx in the geom code appears to be correctly wrapped with > #ifdef KTR, but this is also all that protects the uses of CTRSTACK. > > CTRSTACK is also defined to use stack_ktr conditionally on #ifdef KTR in > sys/stack.h, but the stack_ktr function is compiled in to the kernel only > if DDB is enabled. > > Perhaps CTRSTACK should be non-empty only if both DDB and KTR are defined?OK, the attached patch is necessary, but not quite sufficient to fix the problem. geom_io.c also calls stack_save() under #ifdef KTR, when it needs to be under an #ifdef DDB as well... P.S. Happy New Year everyone! -- David Taylor