On Mon, 2009-11-02 at 22:31 +0000, Dave Anderson wrote:
 ----- "Bob Montgomery" <bob.montgomery(a)hp.com> wrote:
 > This hacky patch allows crash to tell gdb that "mod"
is a command that
 > should get filename completion.  
 
 By any chance, does the "non-standard module directory option" that went
 into 4.0-8.10 work for you, i.e., letting the bash command line do the
 command line completion work:
 
   # crash vmlinux [vmcore] --mod <directory>
 
 Then "mod -S" works by searching from the specified <directory> on down.
I'll take a look at this.  I was mostly curious why some crash commands
had filename completion and some (like mod) did not.
  
 > It does change the behavior of "crash> gdb help mod" and
"crash> gdb
 > mod". 
 Huh? 
I was trying to point out that by adding "mod" to gdb's list of
commands, so that I could tell gdb to use filename completion when
working on the command line of a "mod" command, I also made it appear to
gdb that "mod" was one of its commands (with a dummy do-nothing
execution function).  Normally crash grabs mod, so gdb never gets a
chance to try to execute it.  With this patch, if you send "mod" to gdb
(with "gdb mod"), gdb will execute it.  So the behavior goes from:
crash-4.1.0> gdb mod
Undefined command: "mod".  Try "help".
to this with the patch:
crash> gdb mod
crash>
(Just trying to be thorough :-)
This technique would allow you to add filename completion to any non-gdb
command that might need it.  For instance, you can add filename
completion to "ls" and "less" (or any of the other
"external" commands)
in addition to "mod" with:
        crashcmd_filename_completion("mod");
        crashcmd_filename_completion("ls");
        crashcmd_filename_completion("less");
Bob Montgomery