/* Parser for linespec for the GNU debugger, GDB.
- Copyright 1986, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
+ Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
+ 1996, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
This file is part of GDB.
#include "defs.h"
#include "symtab.h"
-#include "gdbtypes.h"
+#include "frame.h"
+#include "command.h"
#include "symfile.h"
#include "objfiles.h"
-#include "gdbcmd.h"
#include "demangle.h"
-#include "inferior.h"
+#include "value.h"
+#include "completer.h"
/* Prototype for one function in parser-defs.h,
instead of including that entire file. */
{
int i1 = 0;
int ibase;
- struct symbol *sym_class;
char *class_name = type_name_no_tag (t);
/* Ignore this class if it doesn't have a name. This is ugly, but
unless we figure out how to get the physname without the name of
the class, then the loop can't do any good. */
if (class_name
- && (sym_class = lookup_symbol (class_name,
- (struct block *) NULL,
- STRUCT_NAMESPACE,
- (int *) NULL,
- (struct symtab **) NULL)))
+ && (lookup_symbol (class_name, (struct block *) NULL,
+ STRUCT_NAMESPACE, (int *) NULL,
+ (struct symtab **) NULL)))
{
int method_counter;
- /* FIXME: Shouldn't this just be CHECK_TYPEDEF (t)? */
- t = SYMBOL_TYPE (sym_class);
+ CHECK_TYPEDEF (t);
/* Loop over each method name. At this level, all overloads of a name
are counted as a single name. There is an inner loop which loops over
method_name = dem_opname;
}
- if (STREQ (name, method_name))
+ if (strcmp_iw (name, method_name) == 0)
/* Find all the overloaded methods with that name. */
for (field_counter = TYPE_FN_FIELDLIST_LENGTH (t, method_counter) - 1;
field_counter >= 0;
field_counter);
phys_name = alloca (strlen (tmp_name) + 1);
strcpy (phys_name, tmp_name);
- free (tmp_name);
+ xfree (tmp_name);
}
else
phys_name = TYPE_FN_FIELD_PHYSNAME (f, field_counter);
-
+
/* Destructor is handled by caller, dont add it to the list */
if (DESTRUCTOR_PREFIX_P (phys_name))
continue;
alloca (nelts * sizeof (struct symtab_and_line));
return_values.sals = (struct symtab_and_line *)
xmalloc (nelts * sizeof (struct symtab_and_line));
- old_chain = make_cleanup (free, return_values.sals);
+ old_chain = make_cleanup (xfree, return_values.sals);
if (canonical)
{
canonical_arr = (char **) xmalloc (nelts * sizeof (char *));
- make_cleanup (free, canonical_arr);
+ make_cleanup (xfree, canonical_arr);
memset (canonical_arr, 0, nelts * sizeof (char *));
*canonical = canonical_arr;
}
if (canonical_arr)
{
symname = SYMBOL_NAME (sym_arr[num]);
- make_cleanup (free, symname);
+ make_cleanup (xfree, symname);
canonical_arr[i] = savestring (symname, strlen (symname));
}
return_values.sals[i++] = values.sals[num];
int default_line, char ***canonical)
{
struct symtabs_and_lines values;
-#ifdef HPPA_COMPILER_BUG
- /* FIXME: The native HP 9000/700 compiler has a bug which appears
- when optimizing this file with target i960-vxworks. I haven't
- been able to construct a simple test case. The problem is that
- in the second call to SKIP_PROLOGUE below, the compiler somehow
- does not realize that the statement val = find_pc_line (...) will
- change the values of the fields of val. It extracts the elements
- into registers at the top of the block, and does not update the
- registers after the call to find_pc_line. You can check this by
- inserting a printf at the end of find_pc_line to show what values
- it is returning for val.pc and val.end and another printf after
- the call to see what values the function actually got (remember,
- this is compiling with cc -O, with this patch removed). You can
- also examine the assembly listing: search for the second call to
- skip_prologue; the LDO statement before the next call to
- find_pc_line loads the address of the structure which
- find_pc_line will return; if there is a LDW just before the LDO,
- which fetches an element of the structure, then the compiler
- still has the bug.
-
- Setting val to volatile avoids the problem. We must undef
- volatile, because the HPPA native compiler does not define
- __STDC__, although it does understand volatile, and so volatile
- will have been defined away in defs.h. */
-#undef volatile
- volatile struct symtab_and_line val;
-#define volatile /*nothing */
-#else
struct symtab_and_line val;
-#endif
register char *p, *p1;
char *q, *pp, *ii, *p2;
#if 0
/* Maybe arg is FILE : LINENUM or FILE : FUNCTION */
is_quoted = (**argptr
- && strchr (gdb_completer_quote_characters, **argptr) != NULL);
+ && strchr (get_gdb_completer_quote_characters (),
+ **argptr) != NULL);
has_parens = ((pp = strchr (*argptr, '(')) != NULL
&& (pp = strrchr (pp, ')')) != NULL);
if (p[0] == '"')
{
is_quote_enclosed = 1;
+ (*argptr)++;
p++;
}
else
/* if the closing double quote was left at the end, remove it */
if (is_quote_enclosed)
{
- char *closing_quote = strchr (p, '"');
+ char *closing_quote = strchr (p - 1, '"');
if (closing_quote && closing_quote[1] == '\0')
*closing_quote = '\0';
}
/* Arg token is not digits => try it as a function name
Find the next token(everything up to end or next blank). */
if (**argptr
- && strchr (gdb_completer_quote_characters, **argptr) != NULL)
+ && strchr (get_gdb_completer_quote_characters (),
+ **argptr) != NULL)
{
p = skip_quoted (*argptr);
*argptr = *argptr + 1;
copy[p - *argptr] = '\0';
if (p != *argptr
&& copy[p - *argptr - 1]
- && strchr (gdb_completer_quote_characters,
+ && strchr (get_gdb_completer_quote_characters (),
copy[p - *argptr - 1]) != NULL)
copy[p - *argptr - 1] = '\0';
}
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';
if (p != *argptr
&& copy[0]
&& copy[0] == copy[p - *argptr - 1]
- && strchr (gdb_completer_quote_characters, copy[0]) != NULL)
+ && strchr (get_gdb_completer_quote_characters (), copy[0]) != NULL)
{
copy[p - *argptr - 1] = '\0';
copy++;