/* Parser for linespec for the GNU debugger, GDB.
Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
- 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008
- Free Software Foundation, Inc.
+ 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008,
+ 2009 Free Software Foundation, Inc.
This file is part of GDB.
char ***canonical,
char *copy,
struct symbol *sym,
- struct symtab *file_symtab,
- struct symtab *sym_symtab);
+ struct symtab *file_symtab);
static struct
symtabs_and_lines minsym_found (int funfirstline,
the class, then the loop can't do any good. */
if (class_name
&& (lookup_symbol_in_language (class_name, (struct block *) NULL,
- STRUCT_DOMAIN, language, (int *) NULL,
- (struct symtab **) NULL)))
+ STRUCT_DOMAIN, language, (int *) NULL)))
{
int method_counter;
int name_len = strlen (name);
sym_arr[i1] = lookup_symbol_in_language (phys_name,
NULL, VAR_DOMAIN,
language,
- (int *) NULL,
- (struct symtab **) NULL);
+ (int *) NULL);
if (sym_arr[i1])
i1++;
else
sym_arr[i1] = lookup_symbol_in_language (phys_name,
NULL, VAR_DOMAIN,
language,
- (int *) NULL,
- (struct symtab **) NULL);
+ (int *) NULL);
if (sym_arr[i1])
i1++;
}
{
if (canonical_arr[i] == NULL)
{
- symname = DEPRECATED_SYMBOL_NAME (sym_arr[i]);
+ symname = SYMBOL_LINKAGE_NAME (sym_arr[i]);
canonical_arr[i] = savestring (symname, strlen (symname));
}
}
{
if (canonical_arr)
{
- symname = DEPRECATED_SYMBOL_NAME (sym_arr[num]);
+ symname = SYMBOL_LINKAGE_NAME (sym_arr[num]);
make_cleanup (xfree, symname);
canonical_arr[i] = savestring (symname, strlen (symname));
}
return decode_compound (argptr, funfirstline, canonical,
saved_arg, p);
- /* No, the first part is a filename; set s to be that file's
+ /* No, the first part is a filename; set file_symtab to be that file's
symtab. Also, move argptr past the filename. */
file_symtab = symtab_from_filename (argptr, p, is_quote_enclosed,
copy = (char *) alloca (p - *argptr + 1);
memcpy (copy, *argptr, p - *argptr);
copy[p - *argptr] = '\000';
- sym = lookup_symbol (copy, 0, VAR_DOMAIN, 0, &sym_symtab);
+ sym = lookup_symbol (copy, 0, VAR_DOMAIN, 0);
if (sym)
{
*argptr = (*p == '\'') ? p + 1 : p;
- return symbol_found (funfirstline, canonical, copy, sym,
- NULL, sym_symtab);
+ return symbol_found (funfirstline, canonical, copy, sym, NULL);
}
/* Otherwise fall out from here and go to file/line spec
processing, etc. */
}
#endif
- /* S is specified file's symtab, or 0 if no file specified.
+ /* file_symtab is specified file's symtab, or 0 if no file specified.
arg no longer contains the file name. */
/* Check whether arg is all digits (and sign). */
if (file_symtab != NULL)
block = BLOCKVECTOR_BLOCK (BLOCKVECTOR (file_symtab), STATIC_BLOCK);
else
- block = get_selected_block (0);
-
+ {
+ enum language save_language;
+
+ /* get_selected_block can change the current language when there is
+ no selected frame yet. */
+ save_language = current_language->la_language;
+ block = get_selected_block (0);
+ set_language (save_language);
+ }
+
copy = find_imps (file_symtab, block, *argptr, NULL, &i1, &i2);
if (i1 > 0)
char *saved_arg2 = *argptr;
char *temp_end;
struct symbol *sym;
- /* The symtab that SYM was found in. */
- struct symtab *sym_symtab;
char *copy;
struct symbol *sym_class;
struct symbol **sym_arr;
*argptr = (*p == '\'') ? p + 1 : p;
/* Look up entire name */
- sym = lookup_symbol (copy, 0, VAR_DOMAIN, 0, &sym_symtab);
+ sym = lookup_symbol (copy, 0, VAR_DOMAIN, 0);
if (sym)
- return symbol_found (funfirstline, canonical, copy, sym,
- NULL, sym_symtab);
+ return symbol_found (funfirstline, canonical, copy, sym, NULL);
/* Couldn't find any interpretation as classes/namespaces, so give
up. The quotes are important if copy is empty. */
/* At this point p1->"::inA::fun", p->"inA::fun" copy->"AAA",
argptr->"inA::fun" */
- return lookup_symbol (copy, 0, STRUCT_DOMAIN, 0,
- (struct symtab **) NULL);
+ return lookup_symbol (copy, 0, STRUCT_DOMAIN, 0);
}
/* This finds the method COPY in the class whose type is T and whose
sym_arr[i1] =
lookup_symbol (TYPE_FN_FIELD_PHYSNAME (f, f_index),
- NULL, VAR_DOMAIN, (int *) NULL,
- (struct symtab **) NULL);
+ NULL, VAR_DOMAIN, (int *) NULL);
if (sym_arr[i1])
i1++;
}
file_symtab = lookup_symtab (copy);
if (file_symtab == 0)
{
- if (!have_full_symbols () && !have_partial_symbols ())
- error (_("No symbol table is loaded. Use the \"file\" command."));
if (not_found_ptr)
*not_found_ptr = 1;
+ if (!have_full_symbols () && !have_partial_symbols ())
+ throw_error (NOT_FOUND_ERROR,
+ _("No symbol table is loaded. Use the \"file\" command."));
throw_error (NOT_FOUND_ERROR, _("No source file named %s."), copy);
}
struct symtab_and_line val;
char *p;
struct symbol *sym;
- /* The symtab that SYM was found in. */
- struct symtab *sym_symtab;
struct minimal_symbol *msymbol;
p = (copy[1] == '$') ? copy + 2 : copy + 1;
convenience variable. */
/* Look up entire name as a symbol first. */
- sym = lookup_symbol (copy, 0, VAR_DOMAIN, 0, &sym_symtab);
+ sym = lookup_symbol (copy, 0, VAR_DOMAIN, 0);
file_symtab = (struct symtab *) NULL;
need_canonical = 1;
/* Symbol was found --> jump to normal symbol processing. */
if (sym)
- return symbol_found (funfirstline, canonical, copy, sym,
- NULL, sym_symtab);
+ return symbol_found (funfirstline, canonical, copy, sym, NULL);
/* If symbol was not found, look in minimal symbol tables. */
msymbol = lookup_minimal_symbol (copy, NULL, NULL);
struct symtab *file_symtab, int *not_found_ptr)
{
struct symbol *sym;
- /* The symtab that SYM was found in. */
- struct symtab *sym_symtab;
struct minimal_symbol *msymbol;
? BLOCKVECTOR_BLOCK (BLOCKVECTOR (file_symtab),
STATIC_BLOCK)
: get_selected_block (0)),
- VAR_DOMAIN, 0, &sym_symtab);
+ VAR_DOMAIN, 0);
if (sym != NULL)
- return symbol_found (funfirstline, canonical, copy, sym,
- file_symtab, sym_symtab);
+ return symbol_found (funfirstline, canonical, copy, sym, file_symtab);
msymbol = lookup_minimal_symbol (copy, NULL, NULL);
if (msymbol != NULL)
return minsym_found (funfirstline, msymbol);
- if (!have_full_symbols () &&
- !have_partial_symbols () && !have_minimal_symbols ())
- error (_("No symbol table is loaded. Use the \"file\" command."));
-
if (not_found_ptr)
*not_found_ptr = 1;
+
+ if (!have_full_symbols ()
+ && !have_partial_symbols ()
+ && !have_minimal_symbols ())
+ throw_error (NOT_FOUND_ERROR,
+ _("No symbol table is loaded. Use the \"file\" command."));
throw_error (NOT_FOUND_ERROR, _("Function \"%s\" not defined."), copy);
}
static struct symtabs_and_lines
symbol_found (int funfirstline, char ***canonical, char *copy,
- struct symbol *sym, struct symtab *file_symtab,
- struct symtab *sym_symtab)
+ struct symbol *sym, struct symtab *file_symtab)
{
struct symtabs_and_lines values;
function. */
if (file_symtab == 0)
{
- struct blockvector *bv = BLOCKVECTOR (sym_symtab);
+ struct blockvector *bv = BLOCKVECTOR (SYMBOL_SYMTAB (sym));
struct block *b = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
if (lookup_block_symbol (b, copy, NULL, VAR_DOMAIN) != NULL)
build_canonical_line_spec (values.sals, copy, canonical);
xmalloc (sizeof (struct symtab_and_line));
values.nelts = 1;
memset (&values.sals[0], 0, sizeof (values.sals[0]));
- values.sals[0].symtab = sym_symtab;
+ values.sals[0].symtab = SYMBOL_SYMTAB (sym);
values.sals[0].line = SYMBOL_LINE (sym);
return values;
}
values.sals = (struct symtab_and_line *)
xmalloc (sizeof (struct symtab_and_line));
values.sals[0] = find_pc_sect_line (SYMBOL_VALUE_ADDRESS (msymbol),
- (struct bfd_section *) 0, 0);
- values.sals[0].section = SYMBOL_BFD_SECTION (msymbol);
+ (struct obj_section *) 0, 0);
+ values.sals[0].section = SYMBOL_OBJ_SECTION (msymbol);
/* The minimal symbol might point to a function descriptor;
resolve it to the actual code address instead. */