#include "command.h"
#include "symfile.h"
#include "objfiles.h"
+#include "source.h"
#include "demangle.h"
#include "value.h"
#include "completer.h"
#include "cp-abi.h"
-
-/* Prototype for one function in parser-defs.h,
- instead of including that entire file. */
-
-extern char *find_template_name_end (char *);
+#include "parser-defs.h"
/* We share this one with symtab.c, but it is not exported widely. */
(struct symtab **) NULL)))
{
int method_counter;
+ int name_len = strlen (name);
CHECK_TYPEDEF (t);
*/
}
}
- else if (strcmp_iw (class_name, name) == 0)
+ else if (strncmp (class_name, name, name_len) == 0
+ && (class_name[name_len] == '\0'
+ || class_name[name_len] == '<'))
{
/* For GCC 3.x and stabs, constructors and destructors have names
like __base_ctor and __complete_dtor. Check the physname for now
printf_unfiltered ("[0] cancel\n[1] all\n");
while (i < nelts)
{
- INIT_SAL (&return_values.sals[i]); /* initialize to zeroes */
- INIT_SAL (&values.sals[i]);
+ init_sal (&return_values.sals[i]); /* initialize to zeroes */
+ init_sal (&values.sals[i]);
if (sym_arr[i] && SYMBOL_CLASS (sym_arr[i]) == LOC_BLOCK)
{
values.sals[i] = find_function_start_sal (sym_arr[i], funfirstline);
char *saved_arg = *argptr;
extern char *gdb_completer_quote_characters;
- INIT_SAL (&val); /* initialize to zeroes */
+ init_sal (&val); /* initialize to zeroes */
/* Defaults have defaults. */
if (default_symtab == 0)
{
- default_symtab = current_source_symtab;
- default_line = current_source_line;
+ /* Use whatever we have for the default source line. We don't use
+ get_current_or_default_symtab_and_line as it can recurse and call
+ us back! */
+ struct symtab_and_line cursal =
+ get_current_source_symtab_and_line ();
+
+ default_symtab = cursal.symtab;
+ default_line = cursal.line;
}
/* See if arg is *PC */
if ((*p == '"') && is_quote_enclosed)
--p;
copy = (char *) alloca (p - *argptr + 1);
- if ((**argptr == '"') && is_quote_enclosed)
- {
- memcpy (copy, *argptr + 1, p - *argptr - 1);
- /* It may have the ending quote right after the file name */
- if (copy[p - *argptr - 2] == '"')
- copy[p - *argptr - 2] = 0;
- else
- copy[p - *argptr - 1] = 0;
- }
+ memcpy (copy, *argptr, p - *argptr);
+ /* It may have the ending quote right after the file name */
+ if (is_quote_enclosed && copy[p - *argptr - 1] == '"')
+ copy[p - *argptr - 1] = 0;
else
- {
- memcpy (copy, *argptr, p - *argptr);
- copy[p - *argptr] = 0;
- }
+ copy[p - *argptr] = 0;
/* Find that file's data. */
s = lookup_symtab (copy);
/* This is where we need to make sure that we have good defaults.
We must guarantee that this section of code is never executed
when we are called with just a function name, since
- select_source_symtab calls us with such an argument */
+ set_default_source_symtab_and_line uses
+ select_source_symtab that calls us with such an argument */
if (s == 0 && default_symtab == 0)
{
- select_source_symtab (0);
- default_symtab = current_source_symtab;
- default_line = current_source_line;
+ struct symtab_and_line cursal;
+
+ /* Make sure we have at least a default source file. */
+ set_default_source_symtab_and_line ();
+ cursal = get_current_source_symtab_and_line ();
+
+ default_symtab = cursal.symtab;
+ default_line = cursal.line;
}
if (**argptr == '+')