aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Fedor <fedor@gnu.org>2003-08-02 03:59:40 +0000
committerAdam Fedor <fedor@gnu.org>2003-08-02 03:59:40 +0000
commit889f28e262f52b7ccf826ee8e796c2c5cee73d50 (patch)
tree85643e9c4fcdde3a2a9a0060a170fd119932c019
parent87505968d5c8219e4610ccdbc519b6d94529a935 (diff)
downloadgdb-889f28e262f52b7ccf826ee8e796c2c5cee73d50.zip
gdb-889f28e262f52b7ccf826ee8e796c2c5cee73d50.tar.gz
gdb-889f28e262f52b7ccf826ee8e796c2c5cee73d50.tar.bz2
* linespec.c (is_objc_method_format): New function
(decode_line_1, locate_first_half): Use it. Fixes PR objc/1298
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/linespec.c27
2 files changed, 29 insertions, 4 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 360026e..6bc9468 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2003-08-02 Adam Fedor <fedor@gnu.org>
+
+ * linespec.c (is_objc_method_format): New function
+ (decode_line_1, locate_first_half): Use it.
+ Fixes PR objc/1298
+
2003-08-01 Andrew Cagney <cagney@redhat.com>
* NEWS: Mention that m32r is multi-arch.
diff --git a/gdb/linespec.c b/gdb/linespec.c
index 4b863ef..7e8c6a7 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -94,6 +94,8 @@ static void build_canonical_line_spec (struct symtab_and_line *,
static char *find_toplevel_char (char *s, char c);
+static int is_objc_method_format (const char *s);
+
static struct symtabs_and_lines decode_line_2 (struct symbol *[],
int, int, char ***);
@@ -443,6 +445,25 @@ find_toplevel_char (char *s, char c)
return 0;
}
+/* Determines if the gives string corresponds to an Objective-C method
+ representation, such as -[Foo bar:] or +[Foo bar]. Objective-C symbols
+ are allowed to have spaces and parentheses in them. */
+
+static int
+is_objc_method_format (const char *s)
+{
+ if (s == NULL || *s == '\0')
+ return 0;
+ /* Handle arguments with the format FILENAME:SYMBOL. */
+ if ((s[0] == ':') && (strchr ("+-", s[1]) != NULL)
+ && (s[2] == '[') && strchr(s, ']'))
+ return 1;
+ /* Handle arguments that are just SYMBOL. */
+ else if ((strchr ("+-", s[0]) != NULL) && (s[1] == '[') && strchr(s, ']'))
+ return 1;
+ return 0;
+}
+
/* Given a list of NELTS symbols in SYM_ARR, return a list of lines to
operate on (ask user if necessary).
If CANONICAL is non-NULL return a corresponding array of mangled names
@@ -669,8 +690,7 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
/* Check if this is an Objective-C method (anything that starts with
a '+' or '-' and a '['). */
- if (*p && (p[0] == ':') && (strchr ("+-", p[1]) != NULL)
- && (p[2] == '['))
+ if (is_objc_method_format (p))
{
is_objc_method = 1;
paren_pointer = NULL; /* Just a category name. Ignore it. */
@@ -972,8 +992,7 @@ locate_first_half (char **argptr, int *is_quote_enclosed)
}
/* Check for a colon and a plus or minus and a [ (which
indicates an Objective-C method) */
- if (*p && (p[0] == ':') && (strchr ("+-", p[1]) != NULL)
- && (p[2] == '['))
+ if (is_objc_method_format (p))
{
break;
}