+2019-01-10 Tom Tromey <tom@tromey.com>
+
+ * xcoffread.c (scan_xcoff_symtab): Update.
+ * psymtab.c (add_psymbol_to_list): Replace "list" parameter with
+ "where".
+ * mdebugread.c (parse_partial_symbols)
+ (handle_psymbol_enumerators): Update.
+ * dwarf2read.c (add_partial_symbol, load_partial_dies): Update.
+ * dbxread.c (read_dbx_symtab): Update.
+ * psympriv.h (psymbol_placement): New enum.
+ (add_psymbol_to_list): Update.
+
2019-01-10 Tom Tromey <tom@tromey.com>
* xcoffread.c (xcoff_start_psymtab): Remove global_psymbols and
add_psymbol_to_list (sym_name, sym_len, 1,
VAR_DOMAIN, LOC_STATIC,
data_sect_index,
- &objfile->static_psymbols,
+ psymbol_placement::STATIC,
nlist.n_value, psymtab_language, objfile);
continue;
add_psymbol_to_list (sym_name, sym_len, 1,
VAR_DOMAIN, LOC_STATIC,
data_sect_index,
- &objfile->global_psymbols,
+ psymbol_placement::GLOBAL,
nlist.n_value, psymtab_language, objfile);
continue;
{
add_psymbol_to_list (sym_name, sym_len, 1,
STRUCT_DOMAIN, LOC_TYPEDEF, -1,
- &objfile->static_psymbols,
+ psymbol_placement::STATIC,
0, psymtab_language, objfile);
if (p[2] == 't')
{
/* Also a typedef with the same name. */
add_psymbol_to_list (sym_name, sym_len, 1,
VAR_DOMAIN, LOC_TYPEDEF, -1,
- &objfile->static_psymbols,
+ psymbol_placement::STATIC,
0, psymtab_language, objfile);
p += 1;
}
{
add_psymbol_to_list (sym_name, sym_len, 1,
VAR_DOMAIN, LOC_TYPEDEF, -1,
- &objfile->static_psymbols,
+ psymbol_placement::STATIC,
0, psymtab_language, objfile);
}
check_enum:
enum constants in psymtabs, just in symtabs. */
add_psymbol_to_list (p, q - p, 1,
VAR_DOMAIN, LOC_CONST, -1,
- &objfile->static_psymbols, 0,
+ psymbol_placement::STATIC, 0,
psymtab_language, objfile);
/* Point past the name. */
p = q;
/* Constant, e.g. from "const" in Pascal. */
add_psymbol_to_list (sym_name, sym_len, 1,
VAR_DOMAIN, LOC_CONST, -1,
- &objfile->static_psymbols, 0,
+ psymbol_placement::STATIC, 0,
psymtab_language, objfile);
continue;
add_psymbol_to_list (sym_name, sym_len, 1,
VAR_DOMAIN, LOC_BLOCK,
SECT_OFF_TEXT (objfile),
- &objfile->static_psymbols,
+ psymbol_placement::STATIC,
nlist.n_value, psymtab_language, objfile);
continue;
add_psymbol_to_list (sym_name, sym_len, 1,
VAR_DOMAIN, LOC_BLOCK,
SECT_OFF_TEXT (objfile),
- &objfile->global_psymbols,
+ psymbol_placement::GLOBAL,
nlist.n_value, psymtab_language, objfile);
continue;
built_actual_name != NULL,
VAR_DOMAIN, LOC_BLOCK,
SECT_OFF_TEXT (objfile),
- &objfile->global_psymbols,
+ psymbol_placement::GLOBAL,
addr,
cu->language, objfile);
}
built_actual_name != NULL,
VAR_DOMAIN, LOC_BLOCK,
SECT_OFF_TEXT (objfile),
- &objfile->static_psymbols,
+ psymbol_placement::STATIC,
addr, cu->language, objfile);
}
set_objfile_main_name (objfile, actual_name, cu->language);
break;
case DW_TAG_constant:
- {
- std::vector<partial_symbol *> *list;
-
- if (pdi->is_external)
- list = &objfile->global_psymbols;
- else
- list = &objfile->static_psymbols;
- add_psymbol_to_list (actual_name, strlen (actual_name),
- built_actual_name != NULL, VAR_DOMAIN, LOC_STATIC,
- -1, list, 0, cu->language, objfile);
- }
+ add_psymbol_to_list (actual_name, strlen (actual_name),
+ built_actual_name != NULL, VAR_DOMAIN, LOC_STATIC,
+ -1, (pdi->is_external
+ ? psymbol_placement::GLOBAL
+ : psymbol_placement::STATIC),
+ 0, cu->language, objfile);
break;
case DW_TAG_variable:
if (pdi->d.locdesc)
built_actual_name != NULL,
VAR_DOMAIN, LOC_STATIC,
SECT_OFF_TEXT (objfile),
- &objfile->global_psymbols,
+ psymbol_placement::GLOBAL,
addr, cu->language, objfile);
}
else
built_actual_name != NULL,
VAR_DOMAIN, LOC_STATIC,
SECT_OFF_TEXT (objfile),
- &objfile->static_psymbols,
+ psymbol_placement::STATIC,
has_loc ? addr : 0,
cu->language, objfile);
}
add_psymbol_to_list (actual_name, strlen (actual_name),
built_actual_name != NULL,
VAR_DOMAIN, LOC_TYPEDEF, -1,
- &objfile->static_psymbols,
+ psymbol_placement::STATIC,
0, cu->language, objfile);
break;
case DW_TAG_imported_declaration:
add_psymbol_to_list (actual_name, strlen (actual_name),
built_actual_name != NULL,
VAR_DOMAIN, LOC_TYPEDEF, -1,
- &objfile->global_psymbols,
+ psymbol_placement::GLOBAL,
0, cu->language, objfile);
break;
case DW_TAG_module:
add_psymbol_to_list (actual_name, strlen (actual_name),
built_actual_name != NULL,
MODULE_DOMAIN, LOC_TYPEDEF, -1,
- &objfile->global_psymbols,
+ psymbol_placement::GLOBAL,
0, cu->language, objfile);
break;
case DW_TAG_class_type:
built_actual_name != NULL,
STRUCT_DOMAIN, LOC_TYPEDEF, -1,
cu->language == language_cplus
- ? &objfile->global_psymbols
- : &objfile->static_psymbols,
+ ? psymbol_placement::GLOBAL
+ : psymbol_placement::STATIC,
0, cu->language, objfile);
break;
built_actual_name != NULL,
VAR_DOMAIN, LOC_CONST, -1,
cu->language == language_cplus
- ? &objfile->global_psymbols
- : &objfile->static_psymbols,
+ ? psymbol_placement::GLOBAL
+ : psymbol_placement::STATIC,
0, cu->language, objfile);
break;
default:
if (building_psymtab && pdi.name != NULL)
add_psymbol_to_list (pdi.name, strlen (pdi.name), 0,
VAR_DOMAIN, LOC_TYPEDEF, -1,
- &objfile->static_psymbols,
+ psymbol_placement::STATIC,
0, cu->language, objfile);
info_ptr = locate_pdi_sibling (reader, &pdi, info_ptr);
continue;
add_psymbol_to_list (pdi.name, strlen (pdi.name), 0,
VAR_DOMAIN, LOC_CONST, -1,
cu->language == language_cplus
- ? &objfile->global_psymbols
- : &objfile->static_psymbols,
+ ? psymbol_placement::GLOBAL
+ : psymbol_placement::STATIC,
0, cu->language, objfile);
info_ptr = locate_pdi_sibling (reader, &pdi, info_ptr);
add_psymbol_to_list (namestring, p - namestring, 1,
VAR_DOMAIN, LOC_STATIC,
SECT_OFF_DATA (objfile),
- &objfile->static_psymbols,
+ psymbol_placement::STATIC,
sh.value,
psymtab_language, objfile);
continue;
add_psymbol_to_list (namestring, p - namestring, 1,
VAR_DOMAIN, LOC_STATIC,
SECT_OFF_DATA (objfile),
- &objfile->global_psymbols,
+ psymbol_placement::GLOBAL,
sh.value,
psymtab_language, objfile);
continue;
add_psymbol_to_list (namestring, p - namestring, 1,
STRUCT_DOMAIN, LOC_TYPEDEF,
-1,
- &objfile->static_psymbols,
+ psymbol_placement::STATIC,
0, psymtab_language, objfile);
if (p[2] == 't')
{
p - namestring, 1,
VAR_DOMAIN, LOC_TYPEDEF,
-1,
- &objfile->static_psymbols,
+ psymbol_placement::STATIC,
0, psymtab_language,
objfile);
p += 1;
add_psymbol_to_list (namestring, p - namestring, 1,
VAR_DOMAIN, LOC_TYPEDEF,
-1,
- &objfile->static_psymbols,
+ psymbol_placement::STATIC,
0, psymtab_language, objfile);
}
check_enum:
add_psymbol_to_list (p, q - p, 1,
VAR_DOMAIN, LOC_CONST,
-1,
- &objfile->static_psymbols,
+ psymbol_placement::STATIC,
0, psymtab_language,
objfile);
/* Point past the name. */
/* Constant, e.g. from "const" in Pascal. */
add_psymbol_to_list (namestring, p - namestring, 1,
VAR_DOMAIN, LOC_CONST, -1,
- &objfile->static_psymbols,
+ psymbol_placement::STATIC,
0, psymtab_language, objfile);
continue;
add_psymbol_to_list (namestring, p - namestring, 1,
VAR_DOMAIN, LOC_BLOCK,
SECT_OFF_TEXT (objfile),
- &objfile->static_psymbols,
+ psymbol_placement::STATIC,
sh.value,
psymtab_language, objfile);
continue;
add_psymbol_to_list (namestring, p - namestring, 1,
VAR_DOMAIN, LOC_BLOCK,
SECT_OFF_TEXT (objfile),
- &objfile->global_psymbols,
+ psymbol_placement::GLOBAL,
sh.value,
psymtab_language, objfile);
continue;
add_psymbol_to_list (sym_name, strlen (sym_name), 1,
VAR_DOMAIN, LOC_BLOCK,
section,
- &objfile->global_psymbols,
+ psymbol_placement::GLOBAL,
sh.value, psymtab_language, objfile);
else
add_psymbol_to_list (sym_name, strlen (sym_name), 1,
VAR_DOMAIN, LOC_BLOCK,
section,
- &objfile->static_psymbols,
+ psymbol_placement::STATIC,
sh.value, psymtab_language, objfile);
procaddr = sh.value;
{
add_psymbol_to_list (sym_name, strlen (sym_name), 1,
STRUCT_DOMAIN, LOC_TYPEDEF, -1,
- &objfile->static_psymbols,
+ psymbol_placement::STATIC,
0, psymtab_language, objfile);
}
handle_psymbol_enumerators (objfile, fh, sh.st, sh.value);
/* Use this gdb symbol. */
add_psymbol_to_list (sym_name, strlen (sym_name), 1,
VAR_DOMAIN, theclass, section,
- &objfile->static_psymbols,
+ psymbol_placement::STATIC,
sh.value, psymtab_language, objfile);
skip:
cur_sdx++; /* Go to next file symbol. */
add_psymbol_to_list (sym_name, strlen (sym_name), 1,
VAR_DOMAIN, theclass,
section,
- &objfile->global_psymbols,
+ psymbol_placement::GLOBAL,
svalue, psymtab_language, objfile);
}
}
in psymtabs, just in symtabs. */
add_psymbol_to_list (name, strlen (name), 1,
VAR_DOMAIN, LOC_CONST, -1,
- &objfile->static_psymbols, 0,
+ psymbol_placement::STATIC, 0,
psymtab_language, objfile);
ext_sym += external_sym_size;
}
void *read_symtab_private;
};
+/* Specify whether a partial psymbol should be allocated on the global
+ list or the static list. */
+
+enum class psymbol_placement
+{
+ STATIC,
+ GLOBAL
+};
+
/* Add any kind of symbol to a partial_symbol vector. */
extern void add_psymbol_to_list (const char *, int,
int, domain_enum,
enum address_class,
short /* section */,
- std::vector<partial_symbol *> *,
+ enum psymbol_placement,
CORE_ADDR,
enum language, struct objfile *);
domain_enum domain,
enum address_class theclass,
short section,
- std::vector<partial_symbol *> *list,
+ psymbol_placement where,
CORE_ADDR coreaddr,
enum language language, struct objfile *objfile)
{
section, coreaddr, language, objfile, &added);
/* Do not duplicate global partial symbols. */
- if (list == &objfile->global_psymbols
- && !added)
+ if (where == psymbol_placement::GLOBAL && !added)
return;
/* Save pointer to partial symbol in psymtab, growing symtab if needed. */
+ std::vector<partial_symbol *> *list
+ = (where == psymbol_placement::STATIC
+ ? &objfile->static_psymbols
+ : &objfile->global_psymbols);
append_psymbol_to_list (list, psym, objfile);
}
add_psymbol_to_list (namestring, p - namestring, 1,
VAR_DOMAIN, LOC_STATIC,
SECT_OFF_DATA (objfile),
- &objfile->static_psymbols,
+ psymbol_placement::STATIC,
symbol.n_value,
psymtab_language, objfile);
continue;
add_psymbol_to_list (namestring, p - namestring, 1,
VAR_DOMAIN, LOC_STATIC,
SECT_OFF_DATA (objfile),
- &objfile->global_psymbols,
+ psymbol_placement::GLOBAL,
symbol.n_value,
psymtab_language, objfile);
continue;
{
add_psymbol_to_list (namestring, p - namestring, 1,
STRUCT_DOMAIN, LOC_TYPEDEF, -1,
- &objfile->static_psymbols,
+ psymbol_placement::STATIC,
0, psymtab_language, objfile);
if (p[2] == 't')
{
/* Also a typedef with the same name. */
add_psymbol_to_list (namestring, p - namestring, 1,
VAR_DOMAIN, LOC_TYPEDEF, -1,
- &objfile->static_psymbols,
+ psymbol_placement::STATIC,
0, psymtab_language, objfile);
p += 1;
}
{
add_psymbol_to_list (namestring, p - namestring, 1,
VAR_DOMAIN, LOC_TYPEDEF, -1,
- &objfile->static_psymbols,
+ psymbol_placement::STATIC,
0, psymtab_language, objfile);
}
check_enum:
enum constants in psymtabs, just in symtabs. */
add_psymbol_to_list (p, q - p, 1,
VAR_DOMAIN, LOC_CONST, -1,
- &objfile->static_psymbols,
+ psymbol_placement::STATIC,
0, psymtab_language, objfile);
/* Point past the name. */
p = q;
/* Constant, e.g. from "const" in Pascal. */
add_psymbol_to_list (namestring, p - namestring, 1,
VAR_DOMAIN, LOC_CONST, -1,
- &objfile->static_psymbols,
+ psymbol_placement::STATIC,
0, psymtab_language, objfile);
continue;
add_psymbol_to_list (namestring, p - namestring, 1,
VAR_DOMAIN, LOC_BLOCK,
SECT_OFF_TEXT (objfile),
- &objfile->static_psymbols,
+ psymbol_placement::STATIC,
symbol.n_value,
psymtab_language, objfile);
continue;
add_psymbol_to_list (namestring, p - namestring, 1,
VAR_DOMAIN, LOC_BLOCK,
SECT_OFF_TEXT (objfile),
- &objfile->global_psymbols,
+ psymbol_placement::GLOBAL,
symbol.n_value,
psymtab_language, objfile);
continue;