Re: gdb.objc/objcdecode.exp test error..

Matt Rice
2009-09-25T04:03:14Z

[-- Attachment #1: Type: text/plain, Size: 1219 bytes --]

On Wed, Sep 23, 2009 at 5:53 PM, Joel Brobecker <brobecker@adacore.com> wrote:
<snip>

>    (gdb) break create
>
> can result in numerous breakpoints being set if create just happens
> to be the name any ObjC method. And as it turns out, the NSThread
> class has a method called "main"...
>
> I really think that allowing the above shortcut is a mis-feature
> that we should consider removing. We could possibly think about
> introducing another syntax meaning all "create" methods in all
> classes, if it really is needed by ObjC developers.

here is a patch which does this....

the previous patches i'd sent (category.diff) i keep finding failures
that aren't covered by my tests.

so i'll keep working on that and getting more complete test coverage,
I will have to update the tests that I had previously sent

because they tested the various failure modes of this feature mostly,
if we remove it, there are lots of invalid tests in there that need to
be tweaked.

2009-09-24 Matt Rice <ratmice@gmail.com>

* linespec.c: (is_objc_method_format): Allow '[' .... ']' formatted
objc methods.
(decode_line_1): Don't call decode_objc unless its an objc
method format.

[-- Attachment #2: disable-misfeature.patch --]
[-- Type: application/octet-stream, Size: 1860 bytes --]

diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 52149f0..d53886f 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -11085,15 +11085,6 @@ enter:
list +[NSText initialize]
@end smallexample

-In the current version of @value{GDBN}, the plus or minus sign is
-required. In future versions of @value{GDBN}, the plus or minus
-sign will be optional, but you can use it to narrow the search. It
-is also possible to specify just a method name:
-
-@smallexample
-break create
-@end smallexample
-
You must specify the complete method name, including any colons. If
your program's source files contain more than one @code{create} method,
you'll be presented with a numbered list of classes that implement that
diff --git a/gdb/linespec.c b/gdb/linespec.c
index 70e27f7..f4dc4a7 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -466,6 +466,8 @@ is_objc_method_format (const char *s)
if ((s[0] == ':') && (strchr ("+-", s[1]) != NULL)
&& (s[2] == '[') && strchr(s, ']'))
return 1;
+ else if (s[0] == '[' && strchr(s, ']'))
+ return 1;
/* Handle arguments that are just SYMBOL. */
else if ((strchr ("+-", s[0]) != NULL) && (s[1] == '[') && strchr(s, ']'))
return 1;
@@ -739,13 +741,14 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,

/* Check if the symbol could be an Objective-C selector. */

- {
- struct symtabs_and_lines values;
- values = decode_objc (argptr, funfirstline, NULL,
- canonical, saved_arg);
- if (values.sals != NULL)
- return values;
- }
+ if (is_objc_method)
+ {
+ struct symtabs_and_lines values;
+ values = decode_objc (argptr, funfirstline, NULL,
+ canonical, saved_arg);
+ if (values.sals != NULL)
+ return values;
+ }

/* Does it look like there actually were two parts? */