Subject: ddb_onpanic [Re: CVS commit: src/sys/kern]
To: Darren Reed <darrenr@netbsd.org>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: tech-kern
Date: 01/28/2006 14:39:49
[ moved to tech-kern ]

On Sat, Jan 28, 2006 at 12:48:30PM +0000, Darren Reed wrote:
> > If the system is in such a state that ddb can't print its prompt,
> > it's not clear if db_stack_trace_print() will work better. Also, on some
> > platforms, ddb() may need some more initialisations before
> > db_stack_trace_print() will work (it's just theory, I've no example of
> > platforms where this would be the case).
> > Also, with your change there's no way to get the old ddb.onpanic=0
> > behavior: if ddb.onpanic is not 1, db_stack_trace_print will always be
> > called.
> 
> Huh ?
> 
> ddb.onpanic=0 functionality has not changed.  For non-zero values
> that are neither 1 or 2, it has changed, but they're undefined.
> 
> It previously did "if (db_onpanic)" and I made it "if (db_onpanic == 1)"
> 
> The other "changes" were style...
> 
> Or am I missing something ?

In panic() I see:
        if (db_onpanic == 1)
                Debugger();
        else {
                static int intrace = 0;

                if (intrace == 0) {
                        intrace = 1;
                        printf("Begin traceback...\n");
                        db_stack_trace_print(
                            (db_expr_t)(intptr_t)__builtin_frame_address(0),
                            TRUE, 65535, "", printf);
                        printf("End traceback...\n");
                        intrace = 0;
                } else
                        printf("Faulted in mid-traceback; aborting...");
                if (db_onpanic == 2)
                        Debugger();
        }


If db_onpanic is not 1, db_stack_trace_print() will be called, even for
db_onpanic == 0. There's no way to avoid this.
IMHO if we keep this the else should be changed to
else if (db_onpanic != 0)


I will reply to the second part of your mail separately (need to do a few
investigations first).

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
     NetBSD: 26 ans d'experience feront toujours la difference
--