Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Sep 2004 21:59:22 -0400
From:      "Mark W. Krentel" <krentel@dreamscape.com>
To:        freebsd-current@freebsd.org
Subject:   kernel profiling with kernbb and gcov
Message-ID:  <200409150159.i8F1xMSb004864@blue.mwk.domain>

next in thread | raw e-mail | index | archive | help
I can't get kernel profiling with kernbb(8) and gcov(1) to work.  The
kernel compile barfs with the -ftest-coverage and -fprofile-arcs
options.

(1) How do I add these options to the kernel build?  I tried adding
them to COPTFLAGS in make.conf, and all the individual files compile
ok, but when it tries to link them, it dies with a bazillion undefined
references.

    ffsl.o(.text+0x7e): In function `global constructors keyed to ffsl_GCOV':
    : undefined reference to `__gcov_init'
    ffsl.o(.data+0x44): undefined reference to `__gcov_merge_add'
    flsl.o(.text+0x7e): In function `global constructors keyed to flsl_GCOV':
    : undefined reference to `__gcov_init'
    flsl.o(.data+0x44): undefined reference to `__gcov_merge_add'

I can run "gcc -ftest-coverage -fprofile-arcs hello.c" for the "Hello,
world" program, and it works and gcov(1) is happy, but I can't get
these options into the kernel.

(2) Is it --test-coverage or -ftest-coverage, or does it matter?
kernbb(8) says the former, gcov(1) says the latter.

(3) Is there some way to selectively add these options to just some of
the source files?  Do I run config (or "config -p") and hand edit the
Makefile, before "make depend && make"?

This is in 6.0-CURRENT from a week ago.

Thanks,

--Mark



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