From: Jeremy S. <js...@mv...> - 2002-03-01 00:26:31
|
A couple months ago I sent an email about moving the gdb stub from sh-ipl into the kernel for a SW-only kgdb, and heard back from Henry Bell at ST Micro who was working on the same thing -- we've since exchanged some code and I've played around with it some more; the resulting patch is attached. I'd like to add this to the CVS tree in hopes that it will help to have some sort of KGDB available for developers w/o sh-ipl+g or other debug aids; any objections? (It is clearly far from perfect, and is not exhaustively tested, but I've been using it or its cousins for a while and it doesn't seem to break anything too horribly.) Credit for most of this patch goes to Henry; his patch seemed more complete than mine (included threads, sysrq, and gdb-console support) so I went with his... but of course everything is based on existing copies of the stub (such as sh-ipl+g) so thanks to everyone else too! Current major defect: not set up to use ^C or break to get into the running system; if you don't request a startup halt to set breakpoints, you need to use sysrq-g or NMI to get in. (Other aspects of the serial port handling could use serious improvement as well.) While trying this stuff, a couple problems with SCIF handling popped up (esp. w.r.t. break on SH3); this patch includes code which attempt to address these. Comments on those would be appreciated, since they are NOT under KGDB configuration flags. In brief: 1) Flow-control. The sci_throttle() function turns off Rx interrupts, and nothing turns them on again... added an interrupt enable line in sci_unthrottle(), which seemed appropriate? 2) On the SH3 (at least the SH7709A) a <BREAK> caused repeated NUL/FE and BRK interrupts, resulting in a vareity of problems from hanging the port to hanging the kernel [in continuous interrupts]. The best results seemed to be adding a break "hold-down": a flag set on the first BRK interrupt, which causes subsequent BRK an NUL/FE events to be ignored until the first non-NUL. (That char is also discarded if it's 1's then 0's, e.g. 0xF8 or 0xC0 -- the space-to-mark transition ending the break, interpreted as a char.) It's still occasionally flaky: misses a break, gets one extra, or something -- but seems a lot better. I put it under __SH3__ flags, assuming this is common to all SH3 SCI/Fs, though I only have a 7709A and so couldn't test any others. Thanks! --Jeremy Siegel |