[RFC]: Java tab completion

Jeff Johnston jjohnstn@redhat.com
Fri Jun 11 17:49:00 GMT 2004


Ping.

Jeff Johnston wrote:
> The attached patch adds support for tab completion for java symbols.  
> There were two changes required.  First of all, a set of special symbol 
> characters was added.  This is needed because java symbol entries are 
> fully prototyped and make_symbol_completion_list is not prepared for this.
> 
> For example, ptype java.l<tab> should complete the various java.l* 
> symbols.  In the current model, make_symbol_completion_list backs up to 
> the "." and tries to complete l*.  This is completely meaningless as 
> things that start with l like long etc.. are not valid.  The same things 
> applies when you try to set the breakpoint for main: e.g. b jmisc.m<tab> 
> won't expand to jmisc.main(java.lang.String[]) which is needed to set 
> the java main breakpoint.  With the new patch, this is easy to do and 
> saves a lot of hassle to start debugging the program.  The same applies 
> to expanding the myriad of system classes that begin with java.lang, etc..
> 
> The second part of the fix is that I had to remove "." from the list of 
> word break characters for java.  I do not know if there is any hidden 
> repercussions of doing this, but there are no testsuite regressions.  I 
> think a similar thing should be done for C++ concerning ":" so 
> completion of namespaces will work.
> 
> I don't know if I should also remove "(", or "," from the word-break 
> characters.  These characters also appear in prototypes in the symbol 
> table and one could easily tab after them when dealing with member names 
> having multiple prototypes.
> 
> I have added a new scenario to jmisc.exp to test completion of b 
> jmisc.m<tab>
> I noticed that the jmisc test-cases were failing on my RHEL3 system 
> because they are currently expecting <init> to be found in the ptype of 
> jmisc, but gdb appears to be doing the right thing and showing the 
> constructor (jmisc()) so I included a fix for that in my gdb.java 
> testsuite patch.
> 
> Ok to commit?
> 
> -- Jeff J.
> 
> 2004-05-21  Jeff Johnston  <jjohnstn@redhat.com>
> 
>     * language.h (language_special_symbol_chars): New prototype.
>     (struct language_defn): Add new la_special_symbol_chars field.
>     * language.c (language_special_symbol_chars): New function.
>     (unknown_language_defn): Default NULL for special symbol chars.
>     (auto_language_defn): Ditto.
>     (local_language_defn): Ditto.
>     * jv-lang.c (java_special_symbol_chars): New function.
>     (java_word_break_characters): Ditto.
>     (java_language_defn): Add java_special_symbol_chars and
>     java_word_break_characters.
>     * ada-lang.c (ada_language_defn): Default NULL for special
>     symbol chars.
>     * c-lang.c (c_language_defn): Ditto.
>     (cplus_language_defn): Ditto.
>     (asm_language_defn, minimal_language_defn): Ditto.
>     * f-lang.c (f_language_defn): Ditto.
>     * m2-lang.c (m2_language_defn): Ditto.
>     * objc-lang.c (objc_language_defn): Ditto.
>     * p-lang.c (pascal_language_defn): Ditto.
>     * scm-lang.c (scm_language_defn): Ditto.
>     * symtab.c (make_symbol_completion_list): Account for language
>     specific special chars that may occur in symbols.
> 
> gdb/testsuite/ChangeLog:
> 
> 2004-05-21  Jeff Johnston  <jjohnstn@redhat.com>
> 
>     * gdb.java/jmisc.exp: Add java completion test for breaking at java
>     main.  Also fix ptype jmisc test to expect the jmisc() constructor.
>     * gdb.java/jmisc1.exp: Fix ptype jmisc test to expect constructor.
>     * gdb.java/jmisc2.exp: Ditto.



More information about the Gdb-patches mailing list