Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Nov 1999 15:09:06 -0800 (PST)
From:      Julian Elischer <julian@whistle.com>
To:        Greg Lehey <grog@lemis.com>
Cc:        Archie Cobbs <archie@whistle.com>, Zhihui Zhang <zzhang@cs.binghamton.edu>, freebsd-hackers@FreeBSD.ORG
Subject:   Re: How to use gdb to catch a panic
Message-ID:  <Pine.BSF.4.10.9911091457090.14483-100000@current1.whistle.com>
In-Reply-To: <19991109174526.14194@mojave.sitaranetworks.com>

next in thread | previous in thread | raw e-mail | index | archive | help


On Tue, 9 Nov 1999, Greg Lehey wrote:

> 
> On my non-Whistle -CURRENT machine I have:
> 
>   $  sysctl -a | grep debugger
>   debug.debugger_on_panic: 1
> 
> Is this what you're talking about?  Otherwise, what's the difference?

This allows the USER level code to trap to the kernel debugger,
and at the same time specify whether it should run the dgb robot, or the
ddb debugger.

e.g. when a daemon notices a particular symptom that indicates that we
want to look at kernel state. We tend to use it in a similar way to 
the keyboard's <ctl><alt><esc> in order to drop a remote machine (with
serial console) to the gdb debugger. We may not be able to use the
debugger-on-break case, and in any case that can't be done from the
machine itself.

The code is simplicity itself..


#if DDB
static int debugger_type;

static int
sysctl_debug_debugger SYSCTL_HANDLER_ARGS
{
        int     odb;
        int     error;

        odb = debugger_type;
        error  = sysctl_handle_int(oidp,&debugger_type, 0, req);

        if ((error == 0) && req->newptr) {
                if (debugger_type == 0)
                        boothowto &= ~RB_GDB;
                else
                        boothowto |= RB_GDB;
                Debugger("sysctl asked us to enter");
        }
        return (error);
}
SYSCTL_PROC(_debug, OID_AUTO, debugger, CTLTYPE_INT|CTLFLAG_RW,
        0, sizeof debugger_type, sysctl_debug_debugger, "I", "");
#endif

> 
> Greg
> --
> Finger grog@lemis.com for PGP public key
> 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?Pine.BSF.4.10.9911091457090.14483-100000>