From owner-freebsd-hackers@FreeBSD.ORG Wed Sep 8 02:21:13 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 331B116A4D0 for ; Wed, 8 Sep 2004 02:21:13 +0000 (GMT) Received: from mail3.dreamscape.com (mail3.dreamscape.com [206.64.128.213]) by mx1.FreeBSD.org (Postfix) with ESMTP id 83EF843D1F for ; Wed, 8 Sep 2004 02:21:12 +0000 (GMT) (envelope-from krentel@dreamscape.com) Received: from blue.mwk.domain (sA10-p35.dreamscape.com [209.4.252.227]) by mail3.dreamscape.com (8.12.9/8.12.9) with ESMTP id i882L823007515 for ; Tue, 7 Sep 2004 22:21:09 -0400 (EDT) Received: from blue.mwk.domain (localhost [127.0.0.1]) by blue.mwk.domain (8.12.9p2/8.12.9) with ESMTP id i882KZ7W022214 for ; Tue, 7 Sep 2004 22:20:36 -0400 (EDT) (envelope-from krentel@blue.mwk.domain) Message-Id: <200409080220.i882KZ7W022214@blue.mwk.domain> To: freebsd-hackers@freebsd.org Date: Tue, 07 Sep 2004 22:20:35 -0400 From: "Mark W. Krentel" X-Mailman-Approved-At: Wed, 08 Sep 2004 11:47:28 +0000 Subject: kernel profiling with kernbb and gcov X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2004 02:21:13 -0000 I'm trying to do kernel profiling with kernbb(8) and gcov(1), but I can't get the kernel compile to accept the -ftest-coverage and -fprofile-arcs options. (1) Is it --test-coverage or -ftest-coverage, or does it matter? kernbb(8) says the former, gcov(1) says the latter. (2) How do I add these options to the kernel compile? 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. (3) How do I 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 as of a few days ago. Thanks, --Mark