* [PING/RFA]: Search for Objc Symbols
@ 2003-04-27 1:13 Adam Fedor
2003-05-09 17:03 ` Elena Zannoni
0 siblings, 1 reply; 7+ messages in thread
From: Adam Fedor @ 2003-04-27 1:13 UTC (permalink / raw)
To: GDB Patches
[-- Attachment #1: Type: text/plain, Size: 271 bytes --]
I forgot about this one:
http://sources.redhat.com/ml/gdb-patches/2003-01/msg00441.html
It doesn't apprear that this was ever formally approved. I've attached
the patch again since there have been some minor changes since then in
order to keep up with the times...
[-- Attachment #2: symtab-search.patch --]
[-- Type: text/plain, Size: 5864 bytes --]
2003-04-25 Adam Fedor <fedor@gnu.org>
* symtab.c (make_symbol_completion_list): Look for ObjC
symbols.
* Makefile.in (symtab.o): Update dependencies.
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.367
diff -u -p -r1.367 Makefile.in
--- Makefile.in 26 Apr 2003 01:57:28 -0000 1.367
+++ Makefile.in 26 Apr 2003 03:12:16 -0000
@@ -2275,7 +2275,7 @@ symtab.o: symtab.c $(defs_h) $(symtab_h)
$(gdbcmd_h) $(call_cmds_h) $(gdb_regex_h) $(expression_h) \
$(language_h) $(demangle_h) $(inferior_h) $(linespec_h) \
$(filenames_h) $(gdb_obstack_h) $(gdb_string_h) $(gdb_stat_h) \
- $(cp_abi_h) $(source_h) $(block_h)
+ $(cp_abi_h) $(source_h) $(block_h) $(objc_lang_h)
target.o: target.c $(defs_h) $(gdb_string_h) $(target_h) $(gdbcmd_h) \
$(symtab_h) $(inferior_h) $(bfd_h) $(symfile_h) $(objfiles_h) \
$(gdb_wait_h) $(dcache_h) $(regcache_h)
Index: symtab.c
===================================================================
RCS file: /cvs/src/src/gdb/symtab.c,v
retrieving revision 1.101
diff -u -p -r1.101 symtab.c
--- symtab.c 14 Apr 2003 19:56:32 -0000 1.101
+++ symtab.c 26 Apr 2003 03:12:21 -0000
@@ -40,6 +40,7 @@
#include "linespec.h"
#include "source.h"
#include "filenames.h" /* for FILENAME_CMP */
+#include "objc-lang.h"
#include "hashtab.h"
@@ -3527,10 +3541,69 @@ make_symbol_completion_list (char *text,
anything that isn't a text symbol (everything else will be
handled by the psymtab code above). */
+ /* ObjC: In case we are completing on a selector, look thru the msymbols
+ again and feed all the selectors into the mill. */
+
ALL_MSYMBOLS (objfile, msymbol)
{
+ static char *tmp = NULL;
+ static unsigned int tmplen = 0;
+
+ char *method, *category, *selector;
+ char *tmp2 = NULL;
+
QUIT;
- COMPLETION_LIST_ADD_SYMBOL (msymbol, sym_text, sym_text_len, text, word);
+
+ method = SYMBOL_DEMANGLED_NAME (msymbol);
+ if (method == NULL)
+ method = SYMBOL_LINKAGE_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);
+
+ /* 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);
+
+ while ((strlen (method) + 1) >= tmplen)
+ {
+ if (tmplen == 0)
+ tmplen = 1024;
+ else
+ tmplen *= 2;
+ 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);
+ }
}
/* Search upwards from currently selected frame (so that we can
@@ -3548,6 +3621,7 @@ make_symbol_completion_list (char *text,
ALL_BLOCK_SYMBOLS (b, i, sym)
{
+ QUIT;
COMPLETION_LIST_ADD_SYMBOL (sym, sym_text, sym_text_len, text, word);
if (SYMBOL_CLASS (sym) == LOC_TYPEDEF)
{
@@ -3653,15 +3727,45 @@ make_file_symbol_completion_list (char *
}
else
{
- /* It is not a quoted string. Break it based on the characters
- which are in symbols. */
- while (p > text)
- {
- if (isalnum (p[-1]) || p[-1] == '_' || p[-1] == '\0')
- --p;
- else
- break;
- }
+ /* It is not a quoted string. Break it based on the characters
+ which are in symbols. */
+ for (; p > text; --p)
+ {
+ if (isalnum (p[-1]) || p[-1] == '_' || p[-1] == '\0')
+ continue;
+ else
+ {
+ if ((current_language->la_language == language_objc))
+ {
+ if (p[-1] == ':') /* might be part of a method name */
+ continue;
+ else if (p[-1] == '[' && (p[-2] == '-' || p[-2] == '+'))
+ p -= 2; /* beginning of a method name */
+ else if (p[-1] == ' ' || p[-1] == '(' || p[-1] == ')')
+ { /* might be part of a method name */
+ char *t = p;
+
+ /* Seeing a ' ' or a '(' is not conclusive evidence
+ that we are in the middle of a method name. However,
+ finding "-[" or "+[" should be pretty un-ambiguous.
+ Unfortunately we have to find it now to decide. */
+
+ while (t > text)
+ if (isalnum (t[-1]) || t[-1] == '_' ||
+ t[-1] == ' ' || t[-1] == ':' ||
+ t[-1] == '(' || t[-1] == ')')
+ --t;
+ else
+ break;
+
+ if (t[-1] == '[' && (t[-2] == '-' || t[-2] == '+'))
+ p = t - 2; /* method name detected */
+ /* else we leave with p unchanged */
+ }
+ }
+ break;
+ }
+ }
sym_text = p;
}
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PING/RFA]: Search for Objc Symbols
2003-04-27 1:13 [PING/RFA]: Search for Objc Symbols Adam Fedor
@ 2003-05-09 17:03 ` Elena Zannoni
2003-05-11 3:31 ` Adam Fedor
0 siblings, 1 reply; 7+ messages in thread
From: Elena Zannoni @ 2003-05-09 17:03 UTC (permalink / raw)
To: Adam Fedor; +Cc: GDB Patches
Adam Fedor writes:
> I forgot about this one:
>
> http://sources.redhat.com/ml/gdb-patches/2003-01/msg00441.html
>
> It doesn't apprear that this was ever formally approved. I've attached
> the patch again since there have been some minor changes since then in
> order to keep up with the times...
>
>
see below...
> 2003-04-25 Adam Fedor <fedor@gnu.org>
>
> * symtab.c (make_symbol_completion_list): Look for ObjC
> symbols.
> * Makefile.in (symtab.o): Update dependencies.
>
> Index: Makefile.in
> ===================================================================
> RCS file: /cvs/src/src/gdb/Makefile.in,v
> retrieving revision 1.367
> diff -u -p -r1.367 Makefile.in
> --- Makefile.in 26 Apr 2003 01:57:28 -0000 1.367
> +++ Makefile.in 26 Apr 2003 03:12:16 -0000
> @@ -2275,7 +2275,7 @@ symtab.o: symtab.c $(defs_h) $(symtab_h)
> $(gdbcmd_h) $(call_cmds_h) $(gdb_regex_h) $(expression_h) \
> $(language_h) $(demangle_h) $(inferior_h) $(linespec_h) \
> $(filenames_h) $(gdb_obstack_h) $(gdb_string_h) $(gdb_stat_h) \
> - $(cp_abi_h) $(source_h) $(block_h)
> + $(cp_abi_h) $(source_h) $(block_h) $(objc_lang_h)
> target.o: target.c $(defs_h) $(gdb_string_h) $(target_h) $(gdbcmd_h) \
> $(symtab_h) $(inferior_h) $(bfd_h) $(symfile_h) $(objfiles_h) \
> $(gdb_wait_h) $(dcache_h) $(regcache_h)
> Index: symtab.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/symtab.c,v
> retrieving revision 1.101
> diff -u -p -r1.101 symtab.c
> --- symtab.c 14 Apr 2003 19:56:32 -0000 1.101
> +++ symtab.c 26 Apr 2003 03:12:21 -0000
> @@ -40,6 +40,7 @@
> #include "linespec.h"
> #include "source.h"
> #include "filenames.h" /* for FILENAME_CMP */
> +#include "objc-lang.h"
>
> #include "hashtab.h"
>
> @@ -3527,10 +3541,69 @@ make_symbol_completion_list (char *text,
> anything that isn't a text symbol (everything else will be
> handled by the psymtab code above). */
>
> + /* ObjC: In case we are completing on a selector, look thru the msymbols
> + again and feed all the selectors into the mill. */
> +
> ALL_MSYMBOLS (objfile, msymbol)
> {
> + static char *tmp = NULL;
> + static unsigned int tmplen = 0;
> +
> + char *method, *category, *selector;
> + char *tmp2 = NULL;
> +
> QUIT;
> - COMPLETION_LIST_ADD_SYMBOL (msymbol, sym_text, sym_text_len, text, word);
> +
> + method = SYMBOL_DEMANGLED_NAME (msymbol);
> + if (method == NULL)
> + method = SYMBOL_LINKAGE_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);
> +
this should not be needed, I think, i.e. the former macro invocation
should still be ok.
> + /* 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);
> +
> + while ((strlen (method) + 1) >= tmplen)
> + {
> + if (tmplen == 0)
> + tmplen = 1024;
> + else
> + tmplen *= 2;
> + 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);
> + }
Now that I look at this again, I think the code you are adding above could
be easily split up into an objc specific function. Could you do that?
> }
>
> /* Search upwards from currently selected frame (so that we can
> @@ -3548,6 +3621,7 @@ make_symbol_completion_list (char *text,
>
> ALL_BLOCK_SYMBOLS (b, i, sym)
> {
> + QUIT;
> COMPLETION_LIST_ADD_SYMBOL (sym, sym_text, sym_text_len, text, word);
> if (SYMBOL_CLASS (sym) == LOC_TYPEDEF)
> {
There is no changelog entry for this one below.
> @@ -3653,15 +3727,45 @@ make_file_symbol_completion_list (char *
> }
> else
> {
> - /* It is not a quoted string. Break it based on the characters
> - which are in symbols. */
> - while (p > text)
> - {
> - if (isalnum (p[-1]) || p[-1] == '_' || p[-1] == '\0')
> - --p;
> - else
> - break;
> - }
> + /* It is not a quoted string. Break it based on the characters
> + which are in symbols. */
> + for (; p > text; --p)
> + {
> + if (isalnum (p[-1]) || p[-1] == '_' || p[-1] == '\0')
> + continue;
> + else
> + {
> + if ((current_language->la_language == language_objc))
> + {
> + if (p[-1] == ':') /* might be part of a method name */
> + continue;
> + else if (p[-1] == '[' && (p[-2] == '-' || p[-2] == '+'))
> + p -= 2; /* beginning of a method name */
> + else if (p[-1] == ' ' || p[-1] == '(' || p[-1] == ')')
> + { /* might be part of a method name */
> + char *t = p;
> +
> + /* Seeing a ' ' or a '(' is not conclusive evidence
> + that we are in the middle of a method name. However,
> + finding "-[" or "+[" should be pretty un-ambiguous.
> + Unfortunately we have to find it now to decide. */
> +
> + while (t > text)
> + if (isalnum (t[-1]) || t[-1] == '_' ||
> + t[-1] == ' ' || t[-1] == ':' ||
> + t[-1] == '(' || t[-1] == ')')
> + --t;
> + else
> + break;
> +
> + if (t[-1] == '[' && (t[-2] == '-' || t[-2] == '+'))
> + p = t - 2; /* method name detected */
> + /* else we leave with p unchanged */
> + }
> + }
> + break;
> + }
> + }
Same here, could this be made into an objc specific function?
> sym_text = p;
> }
> }
elena
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PING/RFA]: Search for Objc Symbols
2003-05-09 17:03 ` Elena Zannoni
@ 2003-05-11 3:31 ` Adam Fedor
2003-05-11 18:15 ` David Carlton
2003-05-12 18:57 ` Elena Zannoni
0 siblings, 2 replies; 7+ messages in thread
From: Adam Fedor @ 2003-05-11 3:31 UTC (permalink / raw)
To: Elena Zannoni; +Cc: GDB Patches
[-- Attachment #1: Type: text/plain, Size: 327 bytes --]
I've broken out the changes into their own functions. Looking at the
comments in make_file_symbol_completion_list now, it seems like the
language_search_unquoted_string function or something similar should go
in the language vector. But I'm not sure that's necessary, so I didn't
want to do it unless some one made me :-)
[-- Attachment #2: symtab-search2.patch --]
[-- Type: text/plain, Size: 4935 bytes --]
2003-05-10 Adam Fedor <fedor@gnu.org>
* symtab.c (completion_list_objc_symbol): New function.
(make_symbol_completion_list): Use it to add ObjC symbols
when looking though the list.
(language_search_unquoted_string): New function.
(make_file_symbol_completion_list): Use it.
Index: symtab.c
===================================================================
RCS file: /cvs/src/src/gdb/symtab.c,v
retrieving revision 1.102
diff -u -p -r1.102 symtab.c
--- symtab.c 29 Apr 2003 02:34:24 -0000 1.102
+++ symtab.c 11 May 2003 03:13:54 -0000
@@ -3423,6 +3423,116 @@ completion_list_add_name (char *symname,
}
}
+/* ObjC: In case we are completing on a selector, look as the msymbol
+ again and feed all the selectors into the mill. */
+
+static void
+completion_list_objc_symbol (struct minimal_symbol *msymbol, char *sym_text,
+ int sym_text_len, char *text, char *word)
+{
+ static char *tmp = NULL;
+ static unsigned int tmplen = 0;
+
+ char *method, *category, *selector;
+ char *tmp2 = NULL;
+
+ method = SYMBOL_DEMANGLED_NAME (msymbol);
+ if (method == NULL)
+ method = SYMBOL_LINKAGE_NAME (msymbol);
+ if (method == NULL)
+ return;
+
+ /* Is it a method? */
+ if ((method[0] != '-') && (method[0] != '+'))
+ return;
+
+ if (sym_text[0] == '[')
+ /* Complete on shortened method method. */
+ completion_list_add_name (method + 1, sym_text, sym_text_len, text, word);
+
+ while ((strlen (method) + 1) >= tmplen)
+ {
+ if (tmplen == 0)
+ tmplen = 1024;
+ else
+ tmplen *= 2;
+ 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);
+ }
+}
+
+/* Break the non-quoted text based on the characters which are in
+ symbols. */
+
+static char *
+language_search_unquoted_string (char *text, char *p)
+{
+ for (; p > text; --p)
+ {
+ if (isalnum (p[-1]) || p[-1] == '_' || p[-1] == '\0')
+ continue;
+ else
+ {
+ if ((current_language->la_language == language_objc))
+ {
+ if (p[-1] == ':') /* might be part of a method name */
+ continue;
+ else if (p[-1] == '[' && (p[-2] == '-' || p[-2] == '+'))
+ p -= 2; /* beginning of a method name */
+ else if (p[-1] == ' ' || p[-1] == '(' || p[-1] == ')')
+ { /* might be part of a method name */
+ char *t = p;
+
+ /* Seeing a ' ' or a '(' is not conclusive evidence
+ that we are in the middle of a method name. However,
+ finding "-[" or "+[" should be pretty un-ambiguous.
+ Unfortunately we have to find it now to decide. */
+
+ while (t > text)
+ if (isalnum (t[-1]) || t[-1] == '_' ||
+ t[-1] == ' ' || t[-1] == ':' ||
+ t[-1] == '(' || t[-1] == ')')
+ --t;
+ else
+ break;
+
+ if (t[-1] == '[' && (t[-2] == '-' || t[-2] == '+'))
+ p = t - 2; /* method name detected */
+ /* else we leave with p unchanged */
+ }
+ }
+ break;
+ }
+ }
+ return p;
+}
+
+
/* Return a NULL terminated array of all symbols (regardless of class)
which begin by matching TEXT. If the answer is no symbols, then
the return value is an array which contains only a NULL pointer.
@@ -3545,6 +3655,8 @@ make_symbol_completion_list (char *text,
{
QUIT;
COMPLETION_LIST_ADD_SYMBOL (msymbol, sym_text, sym_text_len, text, word);
+
+ completion_list_objc_symbol (msymbol, sym_text, sym_text_len, text, word);
}
/* Search upwards from currently selected frame (so that we can
@@ -3562,6 +3674,7 @@ make_symbol_completion_list (char *text,
ALL_BLOCK_SYMBOLS (b, i, sym)
{
+ QUIT;
COMPLETION_LIST_ADD_SYMBOL (sym, sym_text, sym_text_len, text, word);
if (SYMBOL_CLASS (sym) == LOC_TYPEDEF)
{
@@ -3667,16 +3780,8 @@ make_file_symbol_completion_list (char *
}
else
{
- /* It is not a quoted string. Break it based on the characters
- which are in symbols. */
- while (p > text)
- {
- if (isalnum (p[-1]) || p[-1] == '_' || p[-1] == '\0')
- --p;
- else
- break;
- }
- sym_text = p;
+ /* Not a quoted string. */
+ sym_text = language_search_unquoted_string (text, p);
}
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PING/RFA]: Search for Objc Symbols
2003-05-11 3:31 ` Adam Fedor
@ 2003-05-11 18:15 ` David Carlton
2003-05-12 18:57 ` Elena Zannoni
1 sibling, 0 replies; 7+ messages in thread
From: David Carlton @ 2003-05-11 18:15 UTC (permalink / raw)
To: Adam Fedor; +Cc: Elena Zannoni, GDB Patches
On Sat, 10 May 2003 21:31:03 -0600, Adam Fedor <fedor@doc.com> said:
> + method = SYMBOL_DEMANGLED_NAME (msymbol);
> + if (method == NULL)
> + method = SYMBOL_LINKAGE_NAME (msymbol);
> + if (method == NULL)
> + return;
These should, I think, be replaced by
method = SYMBOL_NATURAL_NAME (msymbol);
Without a test for NULL at the end: the resulting name should never be
NULL.
David Carlton
carlton@math.stanford.edu
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PING/RFA]: Search for Objc Symbols
2003-05-11 3:31 ` Adam Fedor
2003-05-11 18:15 ` David Carlton
@ 2003-05-12 18:57 ` Elena Zannoni
1 sibling, 0 replies; 7+ messages in thread
From: Elena Zannoni @ 2003-05-12 18:57 UTC (permalink / raw)
To: Adam Fedor; +Cc: Elena Zannoni, GDB Patches
Adam Fedor writes:
> I've broken out the changes into their own functions. Looking at the
> comments in make_file_symbol_completion_list now, it seems like the
> language_search_unquoted_string function or something similar should go
> in the language vector. But I'm not sure that's necessary, so I didn't
> want to do it unless some one made me :-)
I think for now you can just add a FIXME to the functions and say that
they should be integrated with the language vector. There are other
things in the symbol table that could be pushed out because they are
more language specific, but I want to think about it (especially with
the namespace changes coming through).
So, this can go in, if you address the concerns that DavidC expressed.
Is this really it??? We have objc?? :-)
elena
>
> 2003-05-10 Adam Fedor <fedor@gnu.org>
>
> * symtab.c (completion_list_objc_symbol): New function.
> (make_symbol_completion_list): Use it to add ObjC symbols
> when looking though the list.
> (language_search_unquoted_string): New function.
> (make_file_symbol_completion_list): Use it.
>
> Index: symtab.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/symtab.c,v
> retrieving revision 1.102
> diff -u -p -r1.102 symtab.c
> --- symtab.c 29 Apr 2003 02:34:24 -0000 1.102
> +++ symtab.c 11 May 2003 03:13:54 -0000
> @@ -3423,6 +3423,116 @@ completion_list_add_name (char *symname,
> }
> }
>
> +/* ObjC: In case we are completing on a selector, look as the msymbol
> + again and feed all the selectors into the mill. */
> +
> +static void
> +completion_list_objc_symbol (struct minimal_symbol *msymbol, char *sym_text,
> + int sym_text_len, char *text, char *word)
> +{
> + static char *tmp = NULL;
> + static unsigned int tmplen = 0;
> +
> + char *method, *category, *selector;
> + char *tmp2 = NULL;
> +
> + method = SYMBOL_DEMANGLED_NAME (msymbol);
> + if (method == NULL)
> + method = SYMBOL_LINKAGE_NAME (msymbol);
> + if (method == NULL)
> + return;
> +
> + /* Is it a method? */
> + if ((method[0] != '-') && (method[0] != '+'))
> + return;
> +
> + if (sym_text[0] == '[')
> + /* Complete on shortened method method. */
> + completion_list_add_name (method + 1, sym_text, sym_text_len, text, word);
> +
> + while ((strlen (method) + 1) >= tmplen)
> + {
> + if (tmplen == 0)
> + tmplen = 1024;
> + else
> + tmplen *= 2;
> + 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);
> + }
> +}
> +
> +/* Break the non-quoted text based on the characters which are in
> + symbols. */
> +
> +static char *
> +language_search_unquoted_string (char *text, char *p)
> +{
> + for (; p > text; --p)
> + {
> + if (isalnum (p[-1]) || p[-1] == '_' || p[-1] == '\0')
> + continue;
> + else
> + {
> + if ((current_language->la_language == language_objc))
> + {
> + if (p[-1] == ':') /* might be part of a method name */
> + continue;
> + else if (p[-1] == '[' && (p[-2] == '-' || p[-2] == '+'))
> + p -= 2; /* beginning of a method name */
> + else if (p[-1] == ' ' || p[-1] == '(' || p[-1] == ')')
> + { /* might be part of a method name */
> + char *t = p;
> +
> + /* Seeing a ' ' or a '(' is not conclusive evidence
> + that we are in the middle of a method name. However,
> + finding "-[" or "+[" should be pretty un-ambiguous.
> + Unfortunately we have to find it now to decide. */
> +
> + while (t > text)
> + if (isalnum (t[-1]) || t[-1] == '_' ||
> + t[-1] == ' ' || t[-1] == ':' ||
> + t[-1] == '(' || t[-1] == ')')
> + --t;
> + else
> + break;
> +
> + if (t[-1] == '[' && (t[-2] == '-' || t[-2] == '+'))
> + p = t - 2; /* method name detected */
> + /* else we leave with p unchanged */
> + }
> + }
> + break;
> + }
> + }
> + return p;
> +}
> +
> +
> /* Return a NULL terminated array of all symbols (regardless of class)
> which begin by matching TEXT. If the answer is no symbols, then
> the return value is an array which contains only a NULL pointer.
> @@ -3545,6 +3655,8 @@ make_symbol_completion_list (char *text,
> {
> QUIT;
> COMPLETION_LIST_ADD_SYMBOL (msymbol, sym_text, sym_text_len, text, word);
> +
> + completion_list_objc_symbol (msymbol, sym_text, sym_text_len, text, word);
> }
>
> /* Search upwards from currently selected frame (so that we can
> @@ -3562,6 +3674,7 @@ make_symbol_completion_list (char *text,
>
> ALL_BLOCK_SYMBOLS (b, i, sym)
> {
> + QUIT;
> COMPLETION_LIST_ADD_SYMBOL (sym, sym_text, sym_text_len, text, word);
> if (SYMBOL_CLASS (sym) == LOC_TYPEDEF)
> {
> @@ -3667,16 +3780,8 @@ make_file_symbol_completion_list (char *
> }
> else
> {
> - /* It is not a quoted string. Break it based on the characters
> - which are in symbols. */
> - while (p > text)
> - {
> - if (isalnum (p[-1]) || p[-1] == '_' || p[-1] == '\0')
> - --p;
> - else
> - break;
> - }
> - sym_text = p;
> + /* Not a quoted string. */
> + sym_text = language_search_unquoted_string (text, p);
> }
> }
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PING/RFA]: Search for Objc Symbols
[not found] ` <3EC45470.9000704@redhat.com>
@ 2003-05-16 4:16 ` Daniel Jacobowitz
0 siblings, 0 replies; 7+ messages in thread
From: Daniel Jacobowitz @ 2003-05-16 4:16 UTC (permalink / raw)
To: Andrew Cagney; +Cc: Adam Fedor, Elena Zannoni, GDB Patches
On Thu, May 15, 2003 at 11:01:04PM -0400, Andrew Cagney wrote:
>
> >Yes(**)! Thanks to everyone who helped get it into gdb.
>
> Time to add it to the NEWS file!
>
> >** The only remaining thing is the hacked out architecture dependant part
> >of objc-lang.c, which only affects systems using the Apple Objective-C
> >runtime. Although, the main gdb line doesn't even configure/compile on
> >Darwin which is the only system that uses the Apple runtime. I actually
> >have a patch to fix this and put the functions into gdbarch, but I'm
> >hesitant to submit them right now as, obviously, I can't test them...
>
> I think C++ has a need for a similar method, perhaps it can be tested
> that way?
Sure - post code to create the method and I'll write some code to use
it.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PING/RFA]: Search for Objc Symbols
@ 2003-05-12 21:02 Adam Fedor
[not found] ` <3EC45470.9000704@redhat.com>
0 siblings, 1 reply; 7+ messages in thread
From: Adam Fedor @ 2003-05-12 21:02 UTC (permalink / raw)
To: Elena Zannoni; +Cc: GDB Patches
> -----Original Message-----
> From: Elena Zannoni [mailto:ezannoni@redhat.com]
> Sent: Monday, May 12, 2003 2:56 PM
> To: Adam Fedor
> Cc: Elena Zannoni; GDB Patches
> Subject: Re: [PING/RFA]: Search for Objc Symbols
>
>
> Adam Fedor writes:
> > I've broken out the changes into their own functions.
> Looking at the
> > comments in make_file_symbol_completion_list now, it seems
> like the
> > language_search_unquoted_string function or something
> similar should go
> > in the language vector. But I'm not sure that's necessary,
> so I didn't
> > want to do it unless some one made me :-)
>
> I think for now you can just add a FIXME to the functions and say that
> they should be integrated with the language vector. There are other
> things in the symbol table that could be pushed out because they are
> more language specific, but I want to think about it (especially with
> the namespace changes coming through).
>
> So, this can go in, if you address the concerns that DavidC expressed.
>
> Is this really it??? We have objc?? :-)
>
Yes(**)! Thanks to everyone who helped get it into gdb.
** The only remaining thing is the hacked out architecture dependant part of objc-lang.c, which only affects systems using the Apple Objective-C runtime. Although, the main gdb line doesn't even configure/compile on Darwin which is the only system that uses the Apple runtime. I actually have a patch to fix this and put the functions into gdbarch, but I'm hesitant to submit them right now as, obviously, I can't test them...
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2003-05-16 4:16 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-27 1:13 [PING/RFA]: Search for Objc Symbols Adam Fedor
2003-05-09 17:03 ` Elena Zannoni
2003-05-11 3:31 ` Adam Fedor
2003-05-11 18:15 ` David Carlton
2003-05-12 18:57 ` Elena Zannoni
2003-05-12 21:02 Adam Fedor
[not found] ` <3EC45470.9000704@redhat.com>
2003-05-16 4:16 ` Daniel Jacobowitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox