Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Apr 95 09:47:51 GMT
From:      "gj%pcs.dec.com@inet-gw-1.pa.dec.com" <garyj@rks32.pcs.dec.com>
To:        hackers%freebsd.org@inet-gw-1.pa.dec.com
Subject:   Re: How do I set a kernel variable? 
Message-ID:  <m0s2FJX-0005PJC@rks32.pcs.dec.com>
In-Reply-To: Message from J Wunsch <j@uriah.heep.sax.de>  of Fri, 21 Apr 95 09:00:44 O.

next in thread | previous in thread | raw e-mail | index | archive | help
As J"org Wunsch wrote:
> As Bill Fenner wrote:
>> 
>> Under FreeBSD, I do
>> 
>> gdb -k /kernel /dev/mem
>> kgdb> set mrtdebug = 1
>> kvm_write:write failed
>
> I've also wondered.  Gary?
>
> What will always work: DDB. :-)

and as Bruce Evans wrote:

> I normally use ddb.
>
> gdb just seems to be braindamaged and buggy here.  Braindamaged: it has
> its own kvm_write() which is quite different from the library kvm_write(),
> and the error message doesn't give the errno.  (The errno is actually
> EBADF, which is surprising considering that an lseek on the bad fd has
> just succeeded.)  Broken: the fd used is for /dev/kmem.  kvm_read() is
> quite differently, and reads from the correct fd (the core_kd arg),
> and seems to work.

I was sort of forced to write (or should I say, steal from the old kgdb)
my own kvm_write because the kvm_write in libkvm doesn't handle "dead"
kernels, i.e. it doesn't work with crash dumps :( In fact, NONE of the
stuff in libkvm works with "dead" kernels ! At least, it didn't at
the time I added the kernel debugging stuff to gdb-4.13.

What I *really* should do is determine whether a "live" kernel is being
debugged and use the libkvm stuff in that case. It doesn't make much sense
to try changing a crash dump, after all, so it doesn't matter whether kvm_write
works for that case.

I kept the names of the routines in libkvm intentionally, in the hope that
at some later point we'd only need to throw away the routines in gdb and
automatically use those in libkvm. But the routines in gdb can be re-named
to avoid name-space pollution.

Guess I need to revamp this stuff, eh ?

I'll look into it.

Gary J.



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