Elena Zannoni wrote: > Adam Fedor writes: > > 2003-01-03 Adam Fedor > > > > * symtab.c (symbol_init_demangled_name): Check for and demangle > > ObjC symbols. > > (make_symbol_completion_list): Look for ObjC symbols > > > > Index: symtab.c > > =================================================================== > > RCS file: /cvs/src/src/gdb/symtab.c,v > > retrieving revision 1.84 > > diff -u -p -r1.84 symtab.c [...snip...] > > + ALL_OBJFILE_MSYMBOLS (objfile, msymbol) > > + { > > + static char *tmp = NULL; > > + static unsigned int tmplen = 0; > > + > > + char *method, *category, *selector; > > + char *tmp2 = NULL; > > + > > + QUIT; > > + > > + method = SYMBOL_DEMANGLED_NAME (msymbol); > > + if (method == NULL) > > + method = SYMBOL_NAME (msymbol); > > + if (method == NULL) > > + continue; > > + > > + /* add the minimal symbol no matter what */ > > + completion_list_add_name (method, sym_text, sym_text_len, text, word); > > + > > Why don't you use the (yes, awful) macro COMPLETION_LIST_ADD_SYMBOL ? > I guess I'm not sure that SYMBOL_NAME(msymbol) is always non-NULL. Is that the case? > > > + /* is it a method? */ > > + if ((method[0] != '-') && (method[0] != '+')) > > + continue; > > + if (sym_text[0] == '[') > > + /* complete on shortened method method */ > > + completion_list_add_name (method + 1, sym_text, sym_text_len, text, word); > > Do you add 2 methods for a symbol that starts with '['? > > > > + > > + while ((strlen (method) + 1) >= tmplen) > > + { > > + tmplen = (tmplen == 0) ? 1024 : tmplen * 2; > > Conditional expressions are generally frowned upon. > > > + tmp = xrealloc (tmp, tmplen); > > + } > > + selector = strchr (method, ' '); > > + if (selector != NULL) > > + selector++; > > + > > + category = strchr (method, '('); > > + > > + if ((category != NULL) && (selector != NULL)) > > + { > > + memcpy (tmp, method, (category - method)); > > + tmp[category - method] = ' '; > > + memcpy (tmp + (category - method) + 1, selector, strlen (selector) + 1); > > + completion_list_add_name (tmp, sym_text, sym_text_len, text, word); > > + if (sym_text[0] == '[') > > + completion_list_add_name (tmp + 1, sym_text, sym_text_len, text, word); > > + } > > + > > + if (selector != NULL) > > + { > > + /* complete on selector only */ > > + strcpy (tmp, selector); > > + tmp2 = strchr (tmp, ']'); > > + if (tmp2 != NULL) > > + *tmp2 = '\0'; > > + > > + completion_list_add_name (tmp, sym_text, sym_text_len, text, word); > > + } > > I am not sure I understand: how many variations of the same name get > added to the completion list? > > > + } > For a particular completion symbol, which could be something like isFlip or [MyObject isFlip You could potentially complete on any of -[MyObject(PrivateCategory) isFlipped] -[MyObject isFlipped] [MyObject isFlipped] isFlipped All of these symbols COULD be unique, although in practice this is unlikely. Attached is an updated patch (second half only).