*BSD News Article 50427


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!simtel!news.kei.com!newshost.marcam.com!usc!cs.utexas.edu!natinst.com!news.dell.com!swrinde!howland.reston.ans.net!Germany.EU.net!zib-berlin.de!irz401!uriah.heep!bonnie.heep!not-for-mail
From: j@bonnie.heep.sax.de (J Wunsch)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: kernel log
Date: 4 Sep 1995 17:06:31 +0200
Organization: Private U**x site, Dresden.
Lines: 28
Message-ID: <42f4ln$rkf@bonnie.tcd-dresden.de>
References: <4284oe$rct@mirv.unsw.edu.au>
Reply-To: joerg_wunsch@uriah.heep.sax.de
NNTP-Posting-Host: 192.109.108.139
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit

Alex Lam <alexl@vast.unsw.edu.au> wrote:

>	I am kinda modifying the kernel, however I really need some
>debug information coming out of it. I noticed there is a special printf
>which I can use, however, that will limit me to only a screen full.
>	Can I infact dump the debug information onto a file ?

Of course :), not.

Handling files is better left to userland utilities.  Use the printf
family (look into sys/kern/subr_prf.c, there's a bunch of functions,
and plain printf() ain't the most appropriate every time), and gather
the output via syslogd(8).  This does also allow you to collect the
information in a file.  Normally, kernel messages are collected in
/var/log/messages.

printf() ``debugging'' is sometimes not a very efficient way to go.
There are two debuggers available for kernel debugging (DDB as on-line
debugger and kgdb (actually, ``gdb -k'') as high-level off-line tool).
Look into the kernel-debug.FAQ for more information.

(The subsection about the preparations for kernel core dumping in the
2.0.5 FAQ file is outdated; -current has this corrected.)
-- 
cheers, J"org                      private:   joerg_wunsch@uriah.heep.sax.de
                                   http://www.sax.de/~joerg/

Never trust an operating system you don't have sources for. ;-)