if (actual_name == NULL)
actual_name = pdi->name;
+ partial_symbol psymbol;
+ memset (&psymbol, 0, sizeof (psymbol));
+ psymbol.ginfo.set_language (cu->language, &objfile->objfile_obstack);
+ psymbol.ginfo.section = -1;
+
+ /* The code below indicates that the psymbol should be installed by
+ setting this. */
+ gdb::optional<psymbol_placement> where;
+
switch (pdi->tag)
{
case DW_TAG_inlined_subroutine:
But in Ada and Fortran, we want to be able to access nested
procedures globally. So all Ada and Fortran subprograms are
stored in the global scope. */
- add_psymbol_to_list (actual_name,
- built_actual_name != NULL,
- VAR_DOMAIN, LOC_BLOCK,
- SECT_OFF_TEXT (objfile),
- psymbol_placement::GLOBAL,
- addr,
- cu->language, objfile);
+ where = psymbol_placement::GLOBAL;
}
else
- {
- add_psymbol_to_list (actual_name,
- built_actual_name != NULL,
- VAR_DOMAIN, LOC_BLOCK,
- SECT_OFF_TEXT (objfile),
- psymbol_placement::STATIC,
- addr, cu->language, objfile);
- }
+ where = psymbol_placement::STATIC;
+
+ psymbol.domain = VAR_DOMAIN;
+ psymbol.aclass = LOC_BLOCK;
+ psymbol.ginfo.section = SECT_OFF_TEXT (objfile);
+ psymbol.ginfo.value.address = addr;
if (pdi->main_subprogram && actual_name != NULL)
set_objfile_main_name (objfile, actual_name, cu->language);
break;
case DW_TAG_constant:
- add_psymbol_to_list (actual_name,
- built_actual_name != NULL, VAR_DOMAIN, LOC_STATIC,
- -1, (pdi->is_external
- ? psymbol_placement::GLOBAL
- : psymbol_placement::STATIC),
- 0, cu->language, objfile);
+ psymbol.domain = VAR_DOMAIN;
+ psymbol.aclass = LOC_STATIC;
+ where = (pdi->is_external
+ ? psymbol_placement::GLOBAL
+ : psymbol_placement::STATIC);
break;
case DW_TAG_variable:
if (pdi->d.locdesc)
table building. */
if (pdi->d.locdesc || pdi->has_type)
- add_psymbol_to_list (actual_name,
- built_actual_name != NULL,
- VAR_DOMAIN, LOC_STATIC,
- SECT_OFF_TEXT (objfile),
- psymbol_placement::GLOBAL,
- addr, cu->language, objfile);
+ {
+ psymbol.domain = VAR_DOMAIN;
+ psymbol.aclass = LOC_STATIC;
+ psymbol.ginfo.section = SECT_OFF_TEXT (objfile);
+ psymbol.ginfo.value.address = addr;
+ where = psymbol_placement::GLOBAL;
+ }
}
else
{
if (!has_loc && !pdi->has_const_value)
return;
- add_psymbol_to_list (actual_name,
- built_actual_name != NULL,
- VAR_DOMAIN, LOC_STATIC,
- SECT_OFF_TEXT (objfile),
- psymbol_placement::STATIC,
- has_loc ? addr : 0,
- cu->language, objfile);
+ psymbol.domain = VAR_DOMAIN;
+ psymbol.aclass = LOC_STATIC;
+ psymbol.ginfo.section = SECT_OFF_TEXT (objfile);
+ if (has_loc)
+ psymbol.ginfo.value.address = addr;
+ where = psymbol_placement::STATIC;
}
break;
case DW_TAG_typedef:
case DW_TAG_base_type:
case DW_TAG_subrange_type:
- add_psymbol_to_list (actual_name,
- built_actual_name != NULL,
- VAR_DOMAIN, LOC_TYPEDEF, -1,
- psymbol_placement::STATIC,
- 0, cu->language, objfile);
+ psymbol.domain = VAR_DOMAIN;
+ psymbol.aclass = LOC_TYPEDEF;
+ where = psymbol_placement::STATIC;
break;
case DW_TAG_imported_declaration:
case DW_TAG_namespace:
- add_psymbol_to_list (actual_name,
- built_actual_name != NULL,
- VAR_DOMAIN, LOC_TYPEDEF, -1,
- psymbol_placement::GLOBAL,
- 0, cu->language, objfile);
+ psymbol.domain = VAR_DOMAIN;
+ psymbol.aclass = LOC_TYPEDEF;
+ where = psymbol_placement::GLOBAL;
break;
case DW_TAG_module:
/* With Fortran 77 there might be a "BLOCK DATA" module
available without any name. If so, we skip the module as it
doesn't bring any value. */
if (actual_name != nullptr)
- add_psymbol_to_list (actual_name,
- built_actual_name != NULL,
- MODULE_DOMAIN, LOC_TYPEDEF, -1,
- psymbol_placement::GLOBAL,
- 0, cu->language, objfile);
+ {
+ psymbol.domain = MODULE_DOMAIN;
+ psymbol.aclass = LOC_TYPEDEF;
+ where = psymbol_placement::GLOBAL;
+ }
break;
case DW_TAG_class_type:
case DW_TAG_interface_type:
/* NOTE: carlton/2003-10-07: See comment in new_symbol about
static vs. global. */
- add_psymbol_to_list (actual_name,
- built_actual_name != NULL,
- STRUCT_DOMAIN, LOC_TYPEDEF, -1,
- cu->language == language_cplus
- ? psymbol_placement::GLOBAL
- : psymbol_placement::STATIC,
- 0, cu->language, objfile);
-
+ psymbol.domain = STRUCT_DOMAIN;
+ psymbol.aclass = LOC_TYPEDEF;
+ where = (cu->language == language_cplus
+ ? psymbol_placement::GLOBAL
+ : psymbol_placement::STATIC);
break;
case DW_TAG_enumerator:
- add_psymbol_to_list (actual_name,
- built_actual_name != NULL,
- VAR_DOMAIN, LOC_CONST, -1,
- cu->language == language_cplus
- ? psymbol_placement::GLOBAL
- : psymbol_placement::STATIC,
- 0, cu->language, objfile);
+ psymbol.domain = VAR_DOMAIN;
+ psymbol.aclass = LOC_CONST;
+ where = (cu->language == language_cplus
+ ? psymbol_placement::GLOBAL
+ : psymbol_placement::STATIC);
break;
default:
break;
}
+
+ if (where.has_value ())
+ {
+ psymbol.ginfo.compute_and_set_names (actual_name,
+ built_actual_name != nullptr,
+ objfile->per_bfd);
+ add_psymbol_to_list (psymbol, *where, objfile);
+ }
}
/* Read a partial die corresponding to a namespace; also, add a symbol