Hack to get filename completion for the mod command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The mod command won't do filename completion.
Sometimes I set up a big ugly directory path for mod -S by starting with
the dir command, using its filename completion to get the modules
directory, and then command-line editing the dir command into a mod -S
command before executing it.  Ahem.

This hacky patch allows crash to tell gdb that "mod" is a command that
should get filename completion.  It's pretty un-smart filename
completion, e.g. doesn't know that sometimes it should be selecting from
a list of modules instead of filenames, etc.  And it messes with the
separation of crash and gdb.  

But mod -S <tab><tab> seems to work.

It does change the behavior of "crash> gdb help mod" and "crash> gdb
mod".  

Bob Montgomery

--- defs.h.orig	2009-11-02 14:45:57.000000000 -0700
+++ defs.h	2009-11-02 14:18:23.000000000 -0700
@@ -4649,6 +4649,7 @@ extern int gdb_main(int, char **);
 #endif
 extern int have_partial_symbols(void); 
 extern int have_full_symbols(void);
+extern void crashcmd_filename_completion(char *);
 
 #if defined(X86) || defined(X86_64) || defined(IA64)
 #define XEN_HYPERVISOR_ARCH 
--- gdb_interface.c.orig	2009-11-02 14:46:09.000000000 -0700
+++ gdb_interface.c	2009-11-02 14:18:23.000000000 -0700
@@ -181,6 +181,7 @@ gdb_session_init(void)
 	gdb_disassemble_from_exec = 0;
 #endif
 
+	crashcmd_filename_completion("mod");
 	pc->flags |= GDB_INIT;   /* set here so gdb_interface will work */
 
         req = (struct gnu_request *)GETBUF(sizeof(struct gnu_request));
--- gdb-6.1.patch.orig	2009-11-02 14:49:30.000000000 -0700
+++ gdb-6.1.patch	2009-11-02 14:49:14.000000000 -0700
@@ -11763,3 +11763,23 @@ diff -urp gdb-6.1.orig/gdb/ChangeLog gdb
  #endif /* VI_MODE */
  
    if (rl_editing_mode == emacs_mode)
+
+--- gdb-6.1/gdb/cli/cli-cmds.c.orig	2009-11-02 14:46:42.000000000 -0700
++++ gdb-6.1/gdb/cli/cli-cmds.c	2009-11-02 14:44:24.000000000 -0700
+@@ -1307,3 +1307,16 @@ With no argument, show definitions of al
+ 				   &setlist),
+ 		      &showlist);
+ }
++
++void
++crashcmd_no_func(char *p, int i)
++{
++}
++
++void
++crashcmd_filename_completion(char *cmd)
++{
++  struct cmd_list_element *c;
++  c = add_cmd(cmd, no_class, crashcmd_no_func, "", &cmdlist);
++  set_cmd_completer (c, filename_completer);
++}
--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/crash-utility

[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux