--- /Volumes/Storage/Users/kdienes/source/cygnus.cygnus/src/gdb/linespec.c Mon Nov 11 16:47:45 2002 +++ linespec.c Mon Nov 11 17:00:39 2002 @@ -39,7 +39,8 @@ static void initialize_defaults (struct symtab **default_symtab, int *default_line); -static void set_flags (char *arg, int *is_quoted, char **paren_pointer); +static void set_flags (char *arg, int *is_quoted, char **paren_pointer, + char **if_pointer); static struct symtabs_and_lines decode_indirect (char **argptr); @@ -203,38 +204,33 @@ from char ** to const char **. */ struct symtabs_and_lines -decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab, - int default_line, char ***canonical) +decode_line_2 (char **argptr, int funfirstline, struct symtab *default_symtab, + int default_line, char ***canonical, + int is_quoted, char *paren_pointer) { - /* This is NULL if there are no parens in *ARGPTR, or a pointer to - the closing parenthesis if there are parens. */ - char *paren_pointer; - /* This says whether or not something in *ARGPTR is quoted with - completer_quotes (i.e. with single quotes). */ - int is_quoted; /* If a file name is specified, this is its symtab. */ struct symtab *file_symtab = NULL; /* This function advances *ARGPTR, but, for error messages, we want to remember what it pointed to initially. */ char *saved_arg = *argptr; - /* Defaults have defaults. */ - - initialize_defaults (&default_symtab, &default_line); - - /* Set various flags. - * 'paren_pointer' is important for overload checking, where - * we allow things like: - * (gdb) break c::f(int) - */ - - set_flags (*argptr, &is_quoted, &paren_pointer); - /* See if arg is *PC. */ if (**argptr == '*') return decode_indirect (argptr); + /* Is it an Objective-C selector? */ + +#if 0 + { + struct symtabs_and_lines values; + values = decode_objc (argptr, funfirstline, file_symtab, + canonical, saved_arg); + if (values.sals != NULL) + return values; + } +#endif + /* Check to see if it's a multipart linespec (with colons or periods). */ { @@ -289,6 +285,48 @@ paren_pointer, file_symtab); } +struct symtabs_and_lines +decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab, + int default_line, char ***canonical) +{ + /* This says whether or not something in *ARGPTR is quoted with + completer_quotes (i.e. with single quotes). */ + int is_quoted; + + /* This is NULL if there are no parens in *ARGPTR, or a pointer to + the closing parenthesis if there are parens. */ + char *paren_pointer; + + /* This is NULL if there is no if-clause at the end of *ARGPTR, or a + pointer to the whitespace before the 'if' if there is. */ + char *if_pointer; + + struct symtabs_and_lines values; + + /* Defaults have defaults. */ + + initialize_defaults (&default_symtab, &default_line); + + /* Set various flags. + * 'paren_pointer' is important for overload checking, where + * we allow things like: + * (gdb) break c::f(int) + */ + + set_flags (*argptr, &is_quoted, &paren_pointer, &if_pointer); + + if (if_pointer != NULL) + *if_pointer = '\0'; + + values = decode_line_2 (argptr, funfirstline, default_symtab, default_line, + canonical, is_quoted, paren_pointer); + + if (if_pointer != NULL) + *if_pointer = ' '; + + return values; +} + /* Now, the helper functions. */ @@ -326,7 +364,7 @@ } static void -set_flags (char *arg, int *is_quoted, char **paren_pointer) +set_flags (char *arg, int *is_quoted, char **paren_pointer, char **if_pointer) { char *if_index; char *paren_start; @@ -372,7 +410,12 @@ /* Now that we're safely past the has_parens check, put back " if (condition)" so outer layers can see it. */ if (has_if) - *if_index = ' '; + { + *if_pointer = if_index; + *if_index = ' '; + } + else + *if_pointer = NULL; }