diff options
author | Tom Tromey <tom@tromey.com> | 2018-05-10 16:23:46 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2019-01-10 07:08:11 -0700 |
commit | 75aedd27e6a2c58734ab44cc7cad8491f19d059a (patch) | |
tree | 6208568d9314888fffc6755303e953fa4064090a /gdb/dwarf2read.c | |
parent | 939652a515a10654b16b97e7e2ea39c013714850 (diff) | |
download | gdb-75aedd27e6a2c58734ab44cc7cad8491f19d059a.zip gdb-75aedd27e6a2c58734ab44cc7cad8491f19d059a.tar.gz gdb-75aedd27e6a2c58734ab44cc7cad8491f19d059a.tar.bz2 |
Change add_psymbol_to_list to use an enum
This changes add_psymbol_to_list to use an enum, rather than a pointer
to a vector, to decide where to put the new symbol. This reduces the
number of direct references to the static_psymbols and global_psymbols
members of the objfile, which is handy in a later patch.
gdb/ChangeLog
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.
Diffstat (limited to 'gdb/dwarf2read.c')
-rw-r--r-- | gdb/dwarf2read.c | 45 |
1 files changed, 20 insertions, 25 deletions
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 338b483..070a0c2 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -8888,7 +8888,7 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu) built_actual_name != NULL, VAR_DOMAIN, LOC_BLOCK, SECT_OFF_TEXT (objfile), - &objfile->global_psymbols, + psymbol_placement::GLOBAL, addr, cu->language, objfile); } @@ -8898,7 +8898,7 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu) built_actual_name != NULL, VAR_DOMAIN, LOC_BLOCK, SECT_OFF_TEXT (objfile), - &objfile->static_psymbols, + psymbol_placement::STATIC, addr, cu->language, objfile); } @@ -8906,17 +8906,12 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu) 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) @@ -8951,7 +8946,7 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu) built_actual_name != NULL, VAR_DOMAIN, LOC_STATIC, SECT_OFF_TEXT (objfile), - &objfile->global_psymbols, + psymbol_placement::GLOBAL, addr, cu->language, objfile); } else @@ -8970,7 +8965,7 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu) 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); } @@ -8981,7 +8976,7 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu) 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: @@ -8989,14 +8984,14 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu) 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: @@ -9021,8 +9016,8 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu) 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; @@ -9031,8 +9026,8 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu) 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: @@ -18440,7 +18435,7 @@ load_partial_dies (const struct die_reader_specs *reader, 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; @@ -18475,8 +18470,8 @@ load_partial_dies (const struct die_reader_specs *reader, 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); |