Remove kernbb(8) from the source tree.
It's been broken for several years and with all the binutils/toolchain changes in flight, it might make more sense to put efforts into dtrace and hwpmc instead. Discussed with: phk PR: bin/83558
This commit is contained in:
parent
4b9b1e1163
commit
54e1a99c14
@ -1,12 +0,0 @@
|
||||
# $FreeBSD$
|
||||
|
||||
PROG= kernbb
|
||||
MAN= kernbb.8
|
||||
|
||||
DPADD= ${LIBKVM}
|
||||
LDADD= -lkvm
|
||||
|
||||
CFLAGS+= -I${.CURDIR}/../../contrib/gcc
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
@ -1,82 +0,0 @@
|
||||
.\" Copyright (c) 1983, 1991, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 4. Neither the name of the University nor the names of its contributors
|
||||
.\" may be used to endorse or promote products derived from this software
|
||||
.\" without specific prior written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd May 22, 1995
|
||||
.Dt KERNBB 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm kernbb
|
||||
.Nd generate a dump of the kernels basic-block profile buffers
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
utility is used to extract the basic-block profiling buffers of the running
|
||||
kernel into the files needed for the
|
||||
.Xr gcov 1
|
||||
tool.
|
||||
.Pp
|
||||
At least one source file in the running kernel must have been compiled
|
||||
with the
|
||||
.Fl Fl test-coverage
|
||||
and
|
||||
.Fl Fl profile-arcs
|
||||
options.
|
||||
.Pp
|
||||
The output is stored in the filenames compiled into the kernel by
|
||||
.Xr gcc 1 .
|
||||
If the absolute pathname cannot be written to, the directory part
|
||||
of the filename is discarded and the file stored in the current
|
||||
directory under its basename.
|
||||
.Pp
|
||||
The output files are named
|
||||
.Pa *.da ,
|
||||
and the
|
||||
.Xr gcov 1
|
||||
program will extract the counts and merge them with the source
|
||||
file to show actual execution counts.
|
||||
.Sh FILES
|
||||
.Bl -tag -width /boot/kernel/kernel -compact
|
||||
.It Pa /boot/kernel/kernel
|
||||
the default system
|
||||
.It Pa /dev/kmem
|
||||
the default memory
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr cc 1 ,
|
||||
.Xr gcov 1
|
||||
.Sh AUTHORS
|
||||
The
|
||||
.Nm
|
||||
utility was written by
|
||||
.An Poul-Henning Kamp ,
|
||||
along with the kernel-support.
|
||||
.Sh BUGS
|
||||
There are far too much magic and internal knowledge from GCC in this.
|
@ -1,145 +0,0 @@
|
||||
/*
|
||||
* ----------------------------------------------------------------------------
|
||||
* "THE BEER-WARE LICENSE" (Revision 42):
|
||||
* <phk@FreeBSD.org> wrote this file. As long as you retain this notice you
|
||||
* can do whatever you want with this stuff. If we meet some day, and you think
|
||||
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
|
||||
* ----------------------------------------------------------------------------
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <err.h>
|
||||
#include <fcntl.h>
|
||||
#include <kvm.h>
|
||||
#include <nlist.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/endian.h>
|
||||
|
||||
typedef long long gcov_type;
|
||||
|
||||
#define PARAMS(foo) foo
|
||||
#define ATTRIBUTE_UNUSED __unused
|
||||
#include "gcov-io.h"
|
||||
|
||||
struct bbf {
|
||||
long checksum;
|
||||
int arc_count;
|
||||
u_long name;
|
||||
};
|
||||
|
||||
struct bb {
|
||||
u_long zero_one;
|
||||
u_long filename;
|
||||
u_long counts;
|
||||
u_long ncounts;
|
||||
u_long next;
|
||||
u_long sizeof_bb;
|
||||
u_long funcs;
|
||||
};
|
||||
|
||||
struct nlist namelist[] = {
|
||||
{ "bbhead", 0, 0, 0, 0 },
|
||||
{ NULL, 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
kvm_t *kv;
|
||||
|
||||
int
|
||||
main(int argc __unused, char **argv __unused)
|
||||
{
|
||||
int i, funcs;
|
||||
u_long l1,l2,l4;
|
||||
struct bb bb;
|
||||
struct bbf bbf;
|
||||
char buf[BUFSIZ], *p;
|
||||
gcov_type *q, *qr;
|
||||
|
||||
FILE *f;
|
||||
|
||||
kv = kvm_open(NULL,NULL,NULL,O_RDWR,"dnc");
|
||||
if (!kv)
|
||||
err(1,"kvm_open");
|
||||
i = kvm_nlist(kv,namelist);
|
||||
if (i)
|
||||
err(1,"kvm_nlist");
|
||||
|
||||
l1 = namelist[0].n_value;
|
||||
kvm_read(kv,l1,&l2,sizeof l2);
|
||||
while(l2) {
|
||||
l1 += sizeof l1;
|
||||
kvm_read(kv,l2,&bb,sizeof bb);
|
||||
#if 0
|
||||
printf("%lx\n%lx\n%lx\n%lx\n%lx\n%lx\n%lx\n",
|
||||
bb.zero_one, bb.filename, bb.counts, bb.ncounts, bb.next,
|
||||
bb.sizeof_bb, bb.funcs);
|
||||
#endif
|
||||
|
||||
funcs = 0;
|
||||
for (l4 = bb.funcs; ; l4 += sizeof (bbf)) {
|
||||
kvm_read(kv, l4, &bbf, sizeof(bbf));
|
||||
if (bbf.arc_count == -1)
|
||||
break;
|
||||
funcs++;
|
||||
}
|
||||
|
||||
l2 = bb.next;
|
||||
|
||||
kvm_read(kv, bb.filename, buf, sizeof(buf));
|
||||
p = buf;
|
||||
f = fopen(p, "w");
|
||||
if (f != NULL) {
|
||||
printf("Writing \"%s\"\n", p);
|
||||
} else {
|
||||
p = strrchr(buf, '/');
|
||||
if (p == NULL)
|
||||
p = buf;
|
||||
else
|
||||
p++;
|
||||
printf("Writing \"%s\" (spec \"%s\")\n", p, buf);
|
||||
f = fopen(p, "w");
|
||||
}
|
||||
if (f == NULL)
|
||||
err(1,"%s", p);
|
||||
__write_long(-123, f, 4);
|
||||
|
||||
__write_long(funcs, f, 4);
|
||||
|
||||
__write_long(4 + 8 + 8 + 4 + 8 + 8, f, 4);
|
||||
|
||||
__write_long(bb.ncounts, f, 4);
|
||||
__write_long(0, f, 8);
|
||||
__write_long(0, f, 8);
|
||||
|
||||
__write_long(bb.ncounts, f, 4);
|
||||
__write_long(0, f, 8);
|
||||
__write_long(0, f, 8);
|
||||
|
||||
qr = malloc(bb.ncounts * 8);
|
||||
kvm_read(kv, bb.counts, qr, bb.ncounts * 8);
|
||||
q = qr;
|
||||
for (l4 = bb.funcs; ; l4 += sizeof (bbf)) {
|
||||
kvm_read(kv, l4, &bbf, sizeof(bbf));
|
||||
if (bbf.arc_count == -1)
|
||||
break;
|
||||
kvm_read(kv, bbf.name, buf, sizeof(buf));
|
||||
|
||||
__write_gcov_string(buf, strlen(buf), f, -1);
|
||||
|
||||
__write_long(bbf.checksum, f, 4);
|
||||
__write_long(bbf.arc_count, f, 4);
|
||||
for (i = 0; i < bbf.arc_count; i++) {
|
||||
__write_gcov_type(*q, f, 8);
|
||||
q++;
|
||||
}
|
||||
}
|
||||
fclose(f);
|
||||
free(qr);
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user