ALL_PSYMTABS (objfile, pst)
{
-#if defined(HPUXHPPA)
- if (pc >= pst->textlow && pc <= pst->texthigh)
-#else
if (pc >= pst->textlow && pc < pst->texthigh)
-#endif
{
struct minimal_symbol *msymbol;
struct partial_symtab *tpst;
for (tpst = pst; tpst != NULL; tpst = tpst->next)
{
-#if defined(HPUXHPPA)
- if (pc >= tpst->textlow && pc <= tpst->texthigh)
-#else
if (pc >= tpst->textlow && pc < tpst->texthigh)
-#endif
{
struct partial_symbol *p;
struct blockvector *bv;
register struct objfile *objfile;
register struct block *block;
- register struct minimal_symbol *msymbol;
/* Now search all the global symbols. Do the symtab's first, then
check the psymtab's. If a psymtab indicates the existence
PC, then use the main symbol.
?!? Is checking the current pc correct? Is this routine
- ever called to look up a symbol from another context? */
+ ever called to look up a symbol from another context?
+
+ FIXME: No, it's not correct. If someone sets a
+ conditional breakpoint at an address, then the
+ breakpoint's `struct expression' should refer to the
+ `struct symbol' appropriate for the breakpoint's
+ address, which may not be the PC.
+
+ Even if it were never called from another context,
+ it's totally bizarre for lookup_symbol's behavior to
+ depend on the value of the inferior's current PC. We
+ should pass in the appropriate PC as well as the
+ block. The interface to lookup_symbol should change
+ to require the caller to provide a PC. */
+
if (SYMBOL_ALIASES (sym))
sym = find_active_alias (sym, read_pc ());
b = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
if (BLOCK_START (b) <= pc
-#if defined(HPUXHPPA)
- && BLOCK_END (b) >= pc
-#else
&& BLOCK_END (b) > pc
-#endif
&& (distance == 0
|| BLOCK_END (b) - BLOCK_START (b) < distance))
{
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.
&& strchr (gdb_completer_quote_characters, **argptr) != NULL);
has_parens = ((pp = strchr (*argptr, '(')) != NULL
- && (pp = strchr (pp, ')')) != NULL);
+ && (pp = strrchr (pp, ')')) != NULL);
/* Now that we're safely past the has_parens check,
* put back " if (condition)" so outer layers can see it
/* 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
*argptr = *argptr + 1;
if (p[0] == '.' || p[1] == ':')
{
- int ix;
char *saved_arg2 = *argptr;
char *temp_end;
/* First check for "global" namespace specification,
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 symbol *sym;
register struct symtab *s;
register struct partial_symtab *ps;
- register struct minimal_symbol *msymbol;
register struct objfile *objfile;
register struct block *b, *surrounding_static_block = 0;
- register int i, j;
- struct partial_symbol **psym;
+ register int i;
/* The name we are completing on. */
char *oload_name = NULL;
/* Length of name. */
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)
{
+ struct partial_symbol **psym;
+
/* If the psymtab's been read in we'll get it when we search
through the blockvector. */
if (ps->readin)
{
/* 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. */