From a6f7cebb1b69be63e66d120173f9a8b4960e6986 Mon Sep 17 00:00:00 2001 From: grog Date: Sun, 11 Apr 1999 03:40:11 +0000 Subject: Back out default debug kernel. The flags revert to historical behaviour. Requested-by: ache bde dg Modify targets for debug kernels: when -g was specified, make will now build a debug kernel called kernel.debug, and create a stripped version called kernel at the same time. The two targets install and install.debug are otherwise unchanged. Requested-by: dillon Update man page accordingly. --- usr.sbin/config/config.8 | 74 +++++++++++++++++++++++++++----------------- usr.sbin/config/main.c | 22 +++---------- usr.sbin/config/mkmakefile.c | 16 ++++++---- 3 files changed, 60 insertions(+), 52 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/config/config.8 b/usr.sbin/config/config.8 index a29ccbd..11a402e 100644 --- a/usr.sbin/config/config.8 +++ b/usr.sbin/config/config.8 @@ -39,7 +39,7 @@ .Nd build system configuration files .Sh SYNOPSIS .Nm config -.Op Fl gprs +.Op Fl gpr .Ar SYSTEM_NAME .Sh DESCRIPTION This is the old version of the @@ -73,8 +73,7 @@ Available options and operands: .Pp .Bl -tag -width SYSTEM_NAME .It Fl g -Configure a system for debugging. This is the default, so this flag has no -meaning, and causes a warning message to be printed. +Configure a system for debugging. .It Fl p Configure a system for profiling; for example, .Xr kgmon 8 @@ -87,10 +86,6 @@ options are supplied, configures a system for high resolution profiling. .It Fl r Remove the old compile directory (see below). -.It Fl s -Configure a system without debugging symbols. This saves both time and space, -but if problems occur with the kernel, it will be almost impossible to find out -their causes. .It Ar SYSTEM_NAME Specifies the name of the system configuration file containing device specifications, configuration options @@ -101,9 +96,12 @@ and other system parameters for one system configuration. should be run from the .Pa conf subdirectory of the system source (usually -.Pa /sys/ARCH/conf ) . +.Pa /sys/ARCH/conf ) , +where +.Pa ARCH +represents one of the architectures supported by FreeBSD. .Nm Config -will create the directory +creates the directory .Pa ../../compile/SYSTEM_NAME as necessary and place all output files there. If the directory already exists and the @@ -152,30 +150,43 @@ are likely to fail. If the option "INCLUDE_CONFIG_FILE" is used in the configuration file the entire input file is embedded in the new kernel. This means that .Xr strings 1 -can be used to extract it from a kernel. -.Pp -Strings | grep ___ will print just the configure information. +can be used to extract it from a kernel: +to extract the configuration information, use the command +.Bd -literal +strings kernel | grep ___ +.Ed .Sh DEBUG KERNELS -Traditional BSD kernels were compiled without symbols due to the heavy load on -the system when compiling a +Traditional BSD kernels compiled without symbols due to the heavy load on the +system when compiling a .if n "debug" .if t ``debug'' kernel. A debug kernel contains complete symbols for all the source files, and enables an experienced kernel programmer to analyse the cause of a problem. The debuggers available prior to 4.4BSD-Lite were able to find some information -from a normal kernel; this is no longer the case with -.Xr gdb 8 , -and a debug kernel is needed for any meaningful analysis. +from a normal kernel; +.Xr gdb 8 +provides very little support for normal kernels, and a debug kernel is needed +for any meaningful analysis. .Pp -Building a debug kernel is the default with FreeBSD, and the -.Fl s -option is required to revert to historical behaviour. A debug kernel takes up -to 30% longer to build and requires about 30 MB of disk storage in the build -directory, compared to about 6 MB for a non-debug kernel. A debug kernel is -about 11 MB in size, compared to about 2 MB for a non-debug kernel. This space -is used both in the root file system and at run time in memory. Since kernel -storage is non-pageable, the additional space required by a debug kernel is lost -to the system when not debugging. +For reasons of history, time and space, building a debug kernel is not the +default with FreeBSD: a debug kernel takes up to 30% longer to build and +requires about 30 MB of disk storage in the build directory, compared to about 6 +MB for a non-debug kernel. A debug kernel is about 11 MB in size, compared to +about 2 MB for a non-debug kernel. This space is used both in the root file +system and at run time in memory. Use the +.Fl g +option to build a debug kernel. With this option, +.Nm +causes two kernel files to be built in the kernel build directory: +.Bl -bullet +.It +.Nm kernel.debug +is the complete debug kernel. +.It +.Nm kernel +is a copy of the kernel with the debug symbols stripped off. This is equivalent +to the normal non-debug kernel. +.El .Pp There is currently little sense in installing and booting from a debug kernel, since the only tools available which use the symbols do not run on-line. There @@ -184,11 +195,15 @@ are therefore two options for installing a debug kernel: .It .Nm make .Ar install -makes a stripped copy of the kernel and installs it in the root file system. +installs +.Nm kernel +in the root file system. .It .Nm make .Ar install.debug -installs the complete debug kernel in the root file system. +installs +.Nm kernel.debug +in the root file system. .El .Sh FILES .Bl -tag -width /sys/i386/conf/Makefile.i386 -compact @@ -208,6 +223,9 @@ name to major device mapping file for the list of files specific to .Em ERNIE system +.It Pa /sys/compile/SYSTEM_NAME +kernel build directory for system +.Pa SYSTEM_NAME . .El .Sh SEE ALSO The SYNOPSIS portion of each device in section 4. diff --git a/usr.sbin/config/main.c b/usr.sbin/config/main.c index f2c0711..b190ab0 100644 --- a/usr.sbin/config/main.c +++ b/usr.sbin/config/main.c @@ -42,7 +42,7 @@ static const char copyright[] = static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93"; #endif static const char rcsid[] = - "$Id: main.c,v 1.27 1999/04/07 09:27:56 grog Exp $"; + "$Id: main.c,v 1.28 1999/04/10 14:03:38 ache Exp $"; #endif /* not lint */ #include @@ -86,13 +86,10 @@ main(argc, argv) int ch; char *p; - debugging = 1; /* on by default */ - while ((ch = getopt(argc, argv, "gprns")) != -1) + while ((ch = getopt(argc, argv, "gprn")) != -1) switch (ch) { case 'g': - fprintf(stderr, - "Debugging is enabled by default, there is " - "no need to specify the -g option\n" ); + debugging++; break; case 'p': profiling++; @@ -105,9 +102,6 @@ main(argc, argv) case 'r': no_config_clobber = FALSE; break; - case 's': - debugging = 0; - break; case '?': default: usage(); @@ -118,14 +112,6 @@ main(argc, argv) if (argc != 1) usage(); - if (debugging) - printf("Building kernel with full debugging symbols. Do\n" - "\"config -s %s\" " - "for historic partial symbolic support.\n" - "To install the debugging kernel, do " - "make install.debug\n", - argv [0] ); - if (freopen(PREFIX = *argv, "r", stdin) == NULL) err(2, "%s", PREFIX); @@ -224,7 +210,7 @@ main(argc, argv) static void usage() { - fprintf(stderr, "usage: config [-gprs] sysname\n"); + fprintf(stderr, "usage: config [-gpr] sysname\n"); exit(1); } diff --git a/usr.sbin/config/mkmakefile.c b/usr.sbin/config/mkmakefile.c index 5c38d23..a2ed836 100644 --- a/usr.sbin/config/mkmakefile.c +++ b/usr.sbin/config/mkmakefile.c @@ -36,7 +36,7 @@ static char sccsid[] = "@(#)mkmakefile.c 8.1 (Berkeley) 6/6/93"; #endif static const char rcsid[] = - "$Id: mkmakefile.c,v 1.34 1998/09/15 21:07:54 gibbs Exp $"; + "$Id: mkmakefile.c,v 1.35 1999/04/07 09:27:56 grog Exp $"; #endif /* not lint */ /* @@ -790,10 +790,7 @@ do_load(f) fputs("all:", f); for (fl = conf_list; fl; fl = fl->f_next) if (fl->f_type == SYSTEMSPEC) - if (debugging) - fprintf(f, " %s.debug", fl->f_needs); - else - fprintf(f, " %s", fl->f_needs); + fprintf(f, " %s", fl->f_needs); putc('\n', f); } @@ -831,7 +828,14 @@ do_systemspec(f, fl, first) fprintf(f, "KERNEL=\t\t%s\n" "FULLKERNEL=\t%s.debug\n" - "INSTALL=\tinstall.debug\n\n", + "INSTALL=\tinstall.debug\n\n" + "%s: %s.debug\n", + fl->f_needs, + fl->f_needs, + fl->f_needs, + fl->f_needs ); + fprintf (f, + "\tobjcopy --strip-debug %s.debug %s\n\n", fl->f_needs, fl->f_needs ); fprintf(f, "%s.debug: ${SYSTEM_DEP} swap%s.o", fl->f_needs, fl->f_fn); -- cgit v1.1