Subject: Re: MI debugger magic key sequence
To: Jeff Smith <jeffs@geocast.com>
From: Eduardo Horvath <eeh@turbolinux.com>
List: tech-kern
Date: 09/21/2000 09:01:44
On Wed, 20 Sep 2000, Jeff Smith wrote:
> Eduardo Horvath wrote:
> >
> > Breaking into the debugger from the console is an interesting problem.
> > Most serial drivers have code to check if they are the console if they
> > receive a BREAK and check if they are the console. Others can have
> > keyboards attached and have checks for specific key sequences.
>
> This is a good thing to clean-up. I've wanted to look at customizing
> it since I've added some stuff to the com driver that we use here (^A).
^A is not a very good key sequence if you ever use emacs on the console.
> > void
> > db_console();
> >
> > This is a MD routine that needs to be defined for each port. It does
> > whatever is necessary to enter the debugger, PROM, whatever.
>
> How is this different from cpu_Debugger()?
cpu_Debugger() is the cpu entry point into DDB and only exists if DDB
is defined. Some machines have other behaviors if DDB is not compiled
in.
cpu_Debugger() is an anathema and should be taken out and shot. It has no
reason to exist and never has.
> > void
> > db_check_magic(dev_t, dev, int k);
Oops. Looks like an extra comma got in there somehow.
> What is the dev used for, or will this interface just always be
> called for every serial port? Right now the serial drivers tend
> to know which port, right?
With the current scheme each serial driver is responsible for figuring out
if it's the console by itself. Since you cannot determine where the
console will be at compile time, all drivers that could potentially be the
console need to have these checks compiled in if DDB is enabled. So as
long as DDB is defined (and on some architectures even if it
isn't) you're taking a hit on all serial ports.
This interface is supposed to be used in the interrupt handler for
incoming characters by all serial drivers and determines whether the dev_t
provided belongs to the console. The only thing the serial driver needs
to do is determine its own dev_t and pass it in to db_check_magic().
> > int
> > db_set_magic(char *magic);
>
> I hadn't thought about this at all, seems like a reasonable thing
> to be able to set it at runtime. It also allows things like the
> mips ports to put this in the machine specific code at start-up
> cleanly.
db_set_magic() will take the magic string and generate a state machine to
match that string. The problem is that different input devices may have
different default key sequences. For instance, serial lines usually use
the BREAK sequence. PC keyboards usually use CTRL-ALT-DELETE. Sun
keyboards use L1(STOP)-A.
> Do any of the ports use chorded sequences for a non-serial console?
Yes.
Eduardo Horvath