Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Sep 2002 11:47:32 +0930
From:      Greg 'groggy' Lehey <grog@FreeBSD.org>
To:        Stacy Millions <stacy@millions.ca>
Cc:        hackers@FreeBSD.org
Subject:   Re: I climb the mountain seeking wisdom
Message-ID:  <20020910021732.GB20691@wantadilla.lemis.com>
In-Reply-To: <3D7D212E.6030601@millions.ca>
References:  <XFMail.20020906135858.jhb@FreeBSD.org> <3D78F291.8010005@millions.ca> <20020908064449.GG46846@wantadilla.lemis.com> <3D7D212E.6030601@millions.ca>

next in thread | previous in thread | raw e-mail | index | archive | help
On Monday,  9 September 2002 at 16:31:10 -0600, Stacy Millions wrote:
> Greg 'groggy' Lehey wrote:
>> On Friday,  6 September 2002 at 12:23:13 -0600, Stacy Millions wrote:
>
>>> Page fault while in kernel mode.... unfortunately, ddb hangs so I don't
>>> get a core file.
>>
>>
>> That's obviously the first thing you should address.
>
> I'm open to suggestions. How can I force a core if ddb freezes? I have
> tried 'sysctl debug.debugger_on_panic=0', but that doesn't help, just
> causes me to have to hit the reset button for different reasons;
> like an infinite loop worth of
> 	kernel trap 12 with interupts disabled

There will always be situations where the debugger can't catch the
problem in time.  Then it's up to you to guess and put a breakpoint
just before it freezes; this can be an interative process.  The method
requiring the least thought is to single step over function calls
until the system freezes.  Then you know which function it happened
in.  Reboot, set a breakpoint in that function, and repeat.

>> Debugging hasn't changed much since 4.3BSD.
>
> True enough, but *what* I am debugging sure has changed. KLD for
> example did not exist the last time I did kernel programming.

Debugging klds is a little more difficult.  You need to use gdb's
add-symbol-file command to get the symbols.  There are some functions
which help, but the good one hasn't been committed yet.  Take a look
at http://people.freebsd.org/~gallatin/gdbmods.

> On the subject of which, I have a question regarding KLD, in my driver,
> the MOD_LOAD does nothing,
> the identify() does a BUS_ADD_CHILD() to the parent (nexus)
> and then probe() and attach() do thier stuff and life is good.
>
> Now I want to do a kldunload and have the driver dettach,
> the MOD_UNLOAD is called, but the detach() is never called. What
> do I need to do to get the detach() to be called? Is there an
> opposite to BUS_ADD_CHILD()? I tried device_delete_child()... gave
> me a panic and no core and devclass_delete_driver()... returned
> an error (ENOENT, I think)

Hmm, haven't had that particular problem, but my klds don't handle
hardware.  Have you looked at similar code in other drivers?

Greg
--
See complete headers for address and phone numbers

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




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