----- "Bob Montgomery" <bob.montgomery(a)hp.com> wrote:
On Tue, 2009-11-03 at 19:00 +0000, Dave Anderson wrote:
> ----- "Bob Montgomery" <bob.montgomery(a)hp.com> wrote:
> I'm sure I don't know why some crasg commands would and some wouldn't?
> I've never tried it, but it must have something to do with the setting
> up of the readline interface, right?
No crash commands do right now, only gdb commands.
(at least one of them does -- see below...)
> What would worry me about that is the error/exception handling,
because
> it would take it out of the crash code and put it in the gdb code.
> Especially in the case of the "mod" command. It's all set up in the
> upper-level crash sources, so by somehow having gdb take over the "mod"
> command, and then have gdb call back to the upper-level crash function,
> and then having some part of that piece fail, the error handling and
> exception thow-backs get a bit murky. I suppose it could be done, but
> I would prefer that crash commands stay as crash commands and gdb commands
> stay as gdb commands, and I would hate to intermingle them. If you follow
> the filename completion code in gdb (I haven't looked at it), I wonder if it
> just tinkers with readline settings?
There is no issue with error handling because gdb is not executing
crash's mod function. gdb is only doing the readline like it always
has, and sending back the completed command line to crash. Then crash
executes the command line with exec_command like it always has. The
only thing I've changed is to modify gdb's readline settings to include
allowing filename completion for any command line that starts with "mod"
(or "less", or "ls"...). The reason I pointed out what happens when
you
do "gdb mod", was to show that I was *not* having gdb do a callback to
crash to execute mod, since what gdb executes when it thinks it's doing
mod is a no-op function. The "mod" command still works the same as
always, except that the first step using gdb's readline function is now
able to allow filename completion for any command that you set up with
my crashcmd_filename_completion() call.
I just didn't see how to change the readline settings without also
putting an entry for "mod" into gdb's command table, since it appears to
use the same entries for both readline features and actual command
stuff. But I made that entry a dummy, just in case some smart alec
decides to force gdb to execute "mod" by doing "gdb mod" instead of
just "mod".
Interesting. If you use the crash "whatis" command, it *does* seem
to have filename-completion tendencies. And that's probably because
gdb has its own "whatis" command which has set the appropriate
readline parameters. So I'm still convinced it's all readline magic,
so that if you really wanted this kind of feature, it could be done
directly without mucking with the gdb code?
In any case, right now I can't wrap my head around this because I just
started working on the transition to gdb-7.0...
In any case, achieving the "mod -S" filename completion works for me
by just using "--mod" on the bash command line during invocation.
Dave