On Wednesday 14 Jan 2004 2:23 am, George Anzinger wrote:
An alternate possibility is an array of pointer to struct kgdb_hook
which allows one to define the struct contents as below and to build the
array, all at compile/link time. A legal entry MUST define get and put,
but why not define them all, using dummy functions for the ones that
make no sense in a particular interface.
Throwing all the stubs in a special section could work well too. Then
we could add an avail() function so that early boot debugging could
discover if each one was available. The serial code could use this to
kickstart itself while the eth code could test a local initialized
flag and say "not a chance". Which gives us all the architecture to
throw in other trivial interfaces (parallel, bus-snoopers, etc.).
I am thinking of something more like what was done with the x86 timer code.
Each timer option sets up a structure with an array of pointers to each
option. There it is done at compile time, and the runtime code tries each. There it is done in order, but here we want to do it a bit differently.
Maybe we could have an "available" flag or just assume that the address
being !=0 for getdebugchar means it is "available". I think there should
be a prefered intface set at config time. Possibly over ride this with the
command line. Then have a back up order in case kgdb wants to communicate
prior to the prefered one being available.
We would also have a rule that the command line over ride only works if
communication has not yet been established. Here, we would also like
control from gdb/kgdb so we could switch to a different interface, but
under gdb control at this point. Either a maintaince command or setting
the "channel" with a memory modify command. We would want this to take
effect only after the current command is acknowledged.
I have something similar in my patches.
Each interface has kgdb_hook function, which returns failure if an interface isn't ready.