From owner-freebsd-hackers Fri Apr 21 02:58:45 1995 Return-Path: hackers-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id CAA05044 for hackers-outgoing; Fri, 21 Apr 1995 02:58:45 -0700 Received: from inet-gw-1.pa.dec.com (inet-gw-1.pa.dec.com [16.1.0.22]) by freefall.cdrom.com (8.6.10/8.6.6) with SMTP id CAA05038 for ; Fri, 21 Apr 1995 02:58:44 -0700 Received: from rks32.pcs.dec.com by inet-gw-1.pa.dec.com (5.65/24Feb95) id AA22671; Fri, 21 Apr 95 02:50:53 -0700 Received: by rks32.pcs.dec.com (Smail3.1.27.1 #16) id m0s2FJX-0005PJC; Fri, 21 Apr 95 11:47 MSZ Message-Id: To: hackers%freebsd.org@inet-gw-1.pa.dec.com In-Reply-To: Message from J Wunsch of Fri, 21 Apr 95 09:00:44 O. Reply-To: gj@FreeBSD.org Subject: Re: How do I set a kernel variable? Date: Fri, 21 Apr 95 09:47:51 GMT From: "gj%pcs.dec.com@inet-gw-1.pa.dec.com" Sender: hackers-owner@FreeBSD.org Precedence: bulk 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.