canonical_arr[0] = canonical_name;
}
+
+
+/* Find an instance of the character C in the string S that is outside
+ of all parenthesis pairs, single-quoted strings, and double-quoted
+ strings. */
+static char *
+find_toplevel_char (char *s, char c)
+{
+ int quoted = 0; /* zero if we're not in quotes;
+ '"' if we're in a double-quoted string;
+ '\'' if we're in a single-quoted string. */
+ int depth = 0; /* number of unclosed parens we've seen */
+ char *scan;
+
+ for (scan = s; *scan; scan++)
+ {
+ if (quoted)
+ {
+ if (*scan == quoted)
+ quoted = 0;
+ else if (*scan == '\\' && *(scan + 1))
+ scan++;
+ }
+ else if (*scan == c && ! quoted && depth == 0)
+ return scan;
+ else if (*scan == '"' || *scan == '\'')
+ quoted = *scan;
+ else if (*scan == '(')
+ depth++;
+ else if (*scan == ')' && depth > 0)
+ depth--;
+ }
+
+ return 0;
+}
+
+
/* Parse a string that specifies a line number.
Pass the address of a char * variable; that variable will be
advanced over the characters actually parsed.
/* Maybe we were called with a line range FILENAME:LINENUM,FILENAME:LINENUM
and we must isolate the first half. Outer layers will call again later
- for the second half */
- if ((ii = strchr (*argptr, ',')) != NULL)
- has_comma = 1;
+ for the second half.
+
+ Don't count commas that appear in argument lists of overloaded
+ functions, or in quoted strings. It's stupid to go to this much
+ trouble when the rest of the function is such an obvious roach hotel. */
+ ii = find_toplevel_char (*argptr, ',');
+ has_comma = (ii != 0);
+
/* Temporarily zap out second half to not
* confuse the code below.
* This is undone below. Do not change ii!!
}
while (p[0] == ' ' || p[0] == '\t')
p++;
+
/* if the closing double quote was left at the end, remove it */
- if (is_quote_enclosed && ((pp = strchr (p, '"')) != NULL))
- if (!*(pp + 1))
- *pp = '\0';
+ if (is_quote_enclosed)
+ {
+ char *closing_quote = strchr (p, '"');
+ if (closing_quote && closing_quote[1] == '\0')
+ *closing_quote = '\0';
+ }
/* Now that we've safely parsed the first half,
* put back ',' so outer layers can see it
p = skip_quoted (*argptr);
}
+ if (is_quote_enclosed && **argptr == '"')
+ (*argptr)++;
+
copy = (char *) alloca (p - *argptr + 1);
memcpy (copy, *argptr, p - *argptr);
copy[p - *argptr] = '\0';
#endif /* 0 */
/* Breakpoint all functions matching regular expression. */
+#ifdef UI_OUT
+void
+rbreak_command_wrapper (regexp, from_tty)
+ char *regexp;
+ int from_tty;
+{
+ rbreak_command (regexp, from_tty);
+}
+#endif
static void
rbreak_command (regexp, from_tty)
char *regexp;
/* skip symbols that cannot match */
if (strcmp (sym_name, oload_name) != 0)
- return;
+ {
+ free (sym_name);
+ return;
+ }
/* If there is no type information, we can't do anything, so skip */
if (SYMBOL_TYPE (sym) == NULL)
register struct symtab *s;
register struct partial_symtab *ps;
register struct objfile *objfile;
- register struct minimal_symbol *msymbol;
register struct block *b, *surrounding_static_block = 0;
register int i;
/* The name we are completing on. */
sym_return_val = (struct symbol **) xmalloc ((sym_return_val_size + 1) * sizeof (struct symbol *));
sym_return_val[0] = NULL;
- /* Comment and #if 0 from Rajiv Mirani <mirani@cup.hp.com>.
- However, leaving #if 0's around is uncool. We need to figure out
- what this is really trying to do, decide whether we want that,
- and either fix it or delete it. --- Jim Blandy, Mar 1999 */
-
- /* ??? RM: What in hell is this? overload_list_add_symbol expects a symbol,
- * not a partial_symbol or a minimal_symbol. And it looks at the type field
- * of the symbol, and we don't know the type of minimal and partial symbols
- */
-#if 0
/* Look through the partial symtabs for all symbols which begin
- by matching OLOAD_NAME. Add each one that you find to the list. */
+ by matching OLOAD_NAME. Make sure we read that symbol table in. */
ALL_PSYMTABS (objfile, ps)
{
{
/* If interrupted, then quit. */
QUIT;
- overload_list_add_symbol (*psym, oload_name);
+ /* This will cause the symbol table to be read if it has not yet been */
+ s = PSYMTAB_TO_SYMTAB (ps);
}
for (psym = objfile->static_psymbols.list + ps->statics_offset;
psym++)
{
QUIT;
- overload_list_add_symbol (*psym, oload_name);
+ /* This will cause the symbol table to be read if it has not yet been */
+ s = PSYMTAB_TO_SYMTAB (ps);
}
}
- /* At this point scan through the misc symbol vectors and add each
- symbol you find to the list. Eventually we want to ignore
- anything that isn't a text symbol (everything else will be
- handled by the psymtab code above). */
-
- ALL_MSYMBOLS (objfile, msymbol)
- {
- QUIT;
- overload_list_add_symbol (msymbol, oload_name);
- }
-#endif
-
/* Search upwards from currently selected frame (so that we can
complete on local vars. */