diff options
author | Christian Biesinger <cbiesinger@google.com> | 2019-12-03 17:10:32 -0600 |
---|---|---|
committer | Christian Biesinger <cbiesinger@google.com> | 2019-12-16 00:44:36 -0600 |
commit | c1b5c1ebc938b6dc0277363b8c47d75b0b5a621f (patch) | |
tree | cd54633651ff68399debc38f92e762b15b607aa2 /gdb | |
parent | 747cfc8c6bb23d40b3fa987f6c3df9d3a0d7b817 (diff) | |
download | gdb-c1b5c1ebc938b6dc0277363b8c47d75b0b5a621f.zip gdb-c1b5c1ebc938b6dc0277363b8c47d75b0b5a621f.tar.gz gdb-c1b5c1ebc938b6dc0277363b8c47d75b0b5a621f.tar.bz2 |
Use an accessor function for general_symbol_info::language
Also renames the member variable to m_language to make code easier to read
when more functions become member functions.
I was originally hoping to eventually make m_language private (after a few
more patches), but unfortunately then it no longer counts as a POD type,
which means gdbsupport/poison.h won't let us use memset to initialize
this type, which psymtabs rely on to clear padding bytes so that bcache
can work properly.
gdb/ChangeLog:
2019-12-15 Christian Biesinger <cbiesinger@google.com>
* ada-lang.c (ada_add_block_symbols): Update.
(ada_collect_symbol_completion_matches): Update.
* ax-gdb.c (gen_expr): Update.
* block.c (block_lookup_symbol): Update.
(block_lookup_symbol_primary): Update.
(block_find_symbol): Update.
* cp-namespace.c (cp_lookup_symbol_imports_or_template): Update.
* dbxread.c (process_one_symbol): Update.
* dictionary.c (insert_symbol_hashed): Update.
(collate_pending_symbols_by_language): Update.
(mdict_add_symbol): Update.
* dwarf-index-write.c (write_psymbols): Update.
* dwarf2read.c (fixup_go_packaging): Update.
* findvar.c (read_var_value): Update.
* ft32-tdep.c (ft32_skip_prologue): Update.
* go-lang.c (go_symbol_package_name): Update.
* language.h (scoped_switch_to_sym_language_if_auto::
scoped_switch_to_sym_language_if_auto): Update.
* linespec.c (find_method): Update.
(find_label_symbols_in_block): Update.
* mdebugread.c (parse_symbol): Update.
* mi/mi-cmd-stack.c (list_arg_or_local): Update.
* minsyms.c (add_minsym_to_demangled_hash_table): Update.
(minimal_symbol_reader::install): Update.
* moxie-tdep.c (moxie_skip_prologue): Update.
* parse.c (parse_exp_in_context): Update.
* psymtab.c (psymbol_name_matches): Update.
(match_partial_symbol): Update.
(lookup_partial_symbol): Update.
(psymbol_hash): Update.
(psymbol_compare): Update.
* python/py-framefilter.c (extract_sym): Update.
(py_print_single_arg): Update.
* stabsread.c (define_symbol): Update.
* stack.c (print_frame_arg): Update.
(find_frame_funname): Update.
(info_frame_command_core): Update.
* symfile.c (set_initial_language): Update.
* symtab.c (symbol_set_demangled_name): Update.
(symbol_get_demangled_name): Update.
(symbol_set_language): Update.
(symbol_find_demangled_name): Update.
(symbol_set_names): Update.
(general_symbol_info::natural_name): Update.
(general_symbol_info::demangled_name): Update.
(general_symbol_info::search_name): Update.
(symbol_matches_search_name): Update.
(eq_symbol_entry): Update.
(iterate_over_symbols): Update.
(completion_list_add_symbol): Update.
(completion_list_add_msymbol): Update.
(completion_list_add_fields): Update.
* symtab.h (struct general_symbol_info) <language>: New function.
<language>: Rename to...
<m_language>: ...this.
(SYMBOL_LANGUAGE): Remove.
(MSYMBOL_LANGUAGE): Remove.
(struct symbol) <ctor>: Update.
* xstormy16-tdep.c (xstormy16_skip_prologue): Update.
Change-Id: I6464d477457e61639c63ddf8b145e407a35c235a
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 62 | ||||
-rw-r--r-- | gdb/ada-lang.c | 13 | ||||
-rw-r--r-- | gdb/ax-gdb.c | 2 | ||||
-rw-r--r-- | gdb/block.c | 10 | ||||
-rw-r--r-- | gdb/cp-namespace.c | 2 | ||||
-rw-r--r-- | gdb/dbxread.c | 4 | ||||
-rw-r--r-- | gdb/dictionary.c | 10 | ||||
-rw-r--r-- | gdb/dwarf-index-write.c | 4 | ||||
-rw-r--r-- | gdb/dwarf2read.c | 2 | ||||
-rw-r--r-- | gdb/findvar.c | 2 | ||||
-rw-r--r-- | gdb/ft32-tdep.c | 2 | ||||
-rw-r--r-- | gdb/go-lang.c | 2 | ||||
-rw-r--r-- | gdb/language.h | 2 | ||||
-rw-r--r-- | gdb/linespec.c | 6 | ||||
-rw-r--r-- | gdb/mdebugread.c | 4 | ||||
-rw-r--r-- | gdb/mi/mi-cmd-stack.c | 2 | ||||
-rw-r--r-- | gdb/minsyms.c | 5 | ||||
-rw-r--r-- | gdb/moxie-tdep.c | 2 | ||||
-rw-r--r-- | gdb/parse.c | 2 | ||||
-rw-r--r-- | gdb/psymtab.c | 16 | ||||
-rw-r--r-- | gdb/python/py-framefilter.c | 8 | ||||
-rw-r--r-- | gdb/stabsread.c | 6 | ||||
-rw-r--r-- | gdb/stack.c | 14 | ||||
-rw-r--r-- | gdb/symfile.c | 2 | ||||
-rw-r--r-- | gdb/symtab.c | 60 | ||||
-rw-r--r-- | gdb/symtab.h | 9 | ||||
-rw-r--r-- | gdb/xstormy16-tdep.c | 2 |
27 files changed, 156 insertions, 99 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8cc1c6b..60cf8c1 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,67 @@ 2019-12-15 Christian Biesinger <cbiesinger@google.com> + * ada-lang.c (ada_add_block_symbols): Update. + (ada_collect_symbol_completion_matches): Update. + * ax-gdb.c (gen_expr): Update. + * block.c (block_lookup_symbol): Update. + (block_lookup_symbol_primary): Update. + (block_find_symbol): Update. + * cp-namespace.c (cp_lookup_symbol_imports_or_template): Update. + * dbxread.c (process_one_symbol): Update. + * dictionary.c (insert_symbol_hashed): Update. + (collate_pending_symbols_by_language): Update. + (mdict_add_symbol): Update. + * dwarf-index-write.c (write_psymbols): Update. + * dwarf2read.c (fixup_go_packaging): Update. + * findvar.c (read_var_value): Update. + * ft32-tdep.c (ft32_skip_prologue): Update. + * go-lang.c (go_symbol_package_name): Update. + * language.h (scoped_switch_to_sym_language_if_auto:: + scoped_switch_to_sym_language_if_auto): Update. + * linespec.c (find_method): Update. + (find_label_symbols_in_block): Update. + * mdebugread.c (parse_symbol): Update. + * mi/mi-cmd-stack.c (list_arg_or_local): Update. + * minsyms.c (add_minsym_to_demangled_hash_table): Update. + (minimal_symbol_reader::install): Update. + * moxie-tdep.c (moxie_skip_prologue): Update. + * parse.c (parse_exp_in_context): Update. + * psymtab.c (psymbol_name_matches): Update. + (match_partial_symbol): Update. + (lookup_partial_symbol): Update. + (psymbol_hash): Update. + (psymbol_compare): Update. + * python/py-framefilter.c (extract_sym): Update. + (py_print_single_arg): Update. + * stabsread.c (define_symbol): Update. + * stack.c (print_frame_arg): Update. + (find_frame_funname): Update. + (info_frame_command_core): Update. + * symfile.c (set_initial_language): Update. + * symtab.c (symbol_set_demangled_name): Update. + (symbol_get_demangled_name): Update. + (symbol_set_language): Update. + (symbol_find_demangled_name): Update. + (symbol_set_names): Update. + (general_symbol_info::natural_name): Update. + (general_symbol_info::demangled_name): Update. + (general_symbol_info::search_name): Update. + (symbol_matches_search_name): Update. + (eq_symbol_entry): Update. + (iterate_over_symbols): Update. + (completion_list_add_symbol): Update. + (completion_list_add_msymbol): Update. + (completion_list_add_fields): Update. + * symtab.h (struct general_symbol_info) <language>: New function. + <language>: Rename to... + <m_language>: ...this. + (SYMBOL_LANGUAGE): Remove. + (MSYMBOL_LANGUAGE): Remove. + (struct symbol) <ctor>: Update. + * xstormy16-tdep.c (xstormy16_skip_prologue): Update. + +2019-12-15 Christian Biesinger <cbiesinger@google.com> + * ada-exp.y (write_ambiguous_var): Call symbol_set_language to set the language of sym. * language.c (language_alloc_type_symbol): Likewise. diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 3289a8e..030c4aa 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -6220,8 +6220,7 @@ ada_add_block_symbols (struct obstack *obstackp, sym != NULL; sym = block_iter_match_next (lookup_name, &iter)) { - if (symbol_matches_domain (SYMBOL_LANGUAGE (sym), - SYMBOL_DOMAIN (sym), domain)) + if (symbol_matches_domain (sym->language (), SYMBOL_DOMAIN (sym), domain)) { if (SYMBOL_CLASS (sym) != LOC_UNRESOLVED) { @@ -6260,7 +6259,7 @@ ada_add_block_symbols (struct obstack *obstackp, ALL_BLOCK_SYMBOLS (block, iter, sym) { - if (symbol_matches_domain (SYMBOL_LANGUAGE (sym), + if (symbol_matches_domain (sym->language (), SYMBOL_DOMAIN (sym), domain)) { int cmp; @@ -6428,7 +6427,7 @@ ada_collect_symbol_completion_matches (completion_tracker &tracker, if (completion_skip_symbol (mode, msymbol)) continue; - language symbol_language = MSYMBOL_LANGUAGE (msymbol); + language symbol_language = msymbol->language (); /* Ada minimal symbols won't have their language set to Ada. If we let completion_list_add_name compare using the @@ -6466,7 +6465,7 @@ ada_collect_symbol_completion_matches (completion_tracker &tracker, continue; completion_list_add_name (tracker, - SYMBOL_LANGUAGE (sym), + sym->language (), sym->linkage_name (), lookup_name, text, word); } @@ -6487,7 +6486,7 @@ ada_collect_symbol_completion_matches (completion_tracker &tracker, continue; completion_list_add_name (tracker, - SYMBOL_LANGUAGE (sym), + sym->language (), sym->linkage_name (), lookup_name, text, word); } @@ -6509,7 +6508,7 @@ ada_collect_symbol_completion_matches (completion_tracker &tracker, continue; completion_list_add_name (tracker, - SYMBOL_LANGUAGE (sym), + sym->language (), sym->linkage_name (), lookup_name, text, word); } diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c index 8489587..d25413e 100644 --- a/gdb/ax-gdb.c +++ b/gdb/ax-gdb.c @@ -2230,7 +2230,7 @@ gen_expr (struct expression *exp, union exp_element **pc, b = block_for_pc (ax->scope); func = block_linkage_function (b); - lang = language_def (SYMBOL_LANGUAGE (func)); + lang = language_def (func->language ()); sym = lookup_language_this (lang, b).symbol; if (!sym) diff --git a/gdb/block.c b/gdb/block.c index b49c548..58441bf 100644 --- a/gdb/block.c +++ b/gdb/block.c @@ -729,7 +729,7 @@ block_lookup_symbol (const struct block *block, const char *name, STRUCT vs VAR domain symbols. So if a matching symbol is found, make sure there is no "better" matching symbol, i.e., one with exactly the same domain. PR 16253. */ - if (symbol_matches_domain (SYMBOL_LANGUAGE (sym), + if (symbol_matches_domain (sym->language (), SYMBOL_DOMAIN (sym), domain)) other = better_symbol (other, sym, domain); } @@ -750,7 +750,7 @@ block_lookup_symbol (const struct block *block, const char *name, ALL_BLOCK_SYMBOLS_WITH_NAME (block, lookup_name, iter, sym) { - if (symbol_matches_domain (SYMBOL_LANGUAGE (sym), + if (symbol_matches_domain (sym->language (), SYMBOL_DOMAIN (sym), domain)) { sym_found = sym; @@ -819,8 +819,7 @@ block_lookup_symbol_primary (const struct block *block, const char *name, STRUCT vs VAR domain symbols. So if a matching symbol is found, make sure there is no "better" matching symbol, i.e., one with exactly the same domain. PR 16253. */ - if (symbol_matches_domain (SYMBOL_LANGUAGE (sym), - SYMBOL_DOMAIN (sym), domain)) + if (symbol_matches_domain (sym->language (), SYMBOL_DOMAIN (sym), domain)) other = better_symbol (other, sym, domain); } @@ -847,8 +846,7 @@ block_find_symbol (const struct block *block, const char *name, { /* MATCHER is deliberately called second here so that it never sees a non-domain-matching symbol. */ - if (symbol_matches_domain (SYMBOL_LANGUAGE (sym), - SYMBOL_DOMAIN (sym), domain) + if (symbol_matches_domain (sym->language (), SYMBOL_DOMAIN (sym), domain) && matcher (sym, data)) return sym; } diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c index d813d05..20067cd 100644 --- a/gdb/cp-namespace.c +++ b/gdb/cp-namespace.c @@ -516,7 +516,7 @@ cp_lookup_symbol_imports_or_template (const char *scope, domain_name (domain)); } - if (function != NULL && SYMBOL_LANGUAGE (function) == language_cplus) + if (function != NULL && function->language () == language_cplus) { /* Search the function's template parameters. */ if (SYMBOL_IS_CPLUS_TEMPLATE_FUNCTION (function)) diff --git a/gdb/dbxread.c b/gdb/dbxread.c index 73f1ba8..ecfa89a 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -2456,7 +2456,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name, cstk.start_addr, cstk.start_addr + valu); /* For C++, set the block's scope. */ - if (SYMBOL_LANGUAGE (cstk.name) == language_cplus) + if (cstk.name->language () == language_cplus) cp_set_block_scope (cstk.name, block, &objfile->objfile_obstack); /* May be switching to an assembler file which may not be using @@ -2823,7 +2823,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name, cstk.start_addr, valu); /* For C++, set the block's scope. */ - if (SYMBOL_LANGUAGE (cstk.name) == language_cplus) + if (cstk.name->language () == language_cplus) cp_set_block_scope (cstk.name, block, &objfile->objfile_obstack); } diff --git a/gdb/dictionary.c b/gdb/dictionary.c index 0d13370..125a062 100644 --- a/gdb/dictionary.c +++ b/gdb/dictionary.c @@ -640,9 +640,9 @@ insert_symbol_hashed (struct dictionary *dict, /* We don't want to insert a symbol into a dictionary of a different language. The two may not use the same hashing algorithm. */ - gdb_assert (SYMBOL_LANGUAGE (sym) == DICT_LANGUAGE (dict)->la_language); + gdb_assert (sym->language () == DICT_LANGUAGE (dict)->la_language); - hash = search_name_hash (SYMBOL_LANGUAGE (sym), sym->search_name ()); + hash = search_name_hash (sym->language (), sym->search_name ()); hash_index = hash % DICT_HASHED_NBUCKETS (dict); sym->hash_next = buckets[hash_index]; buckets[hash_index] = sym; @@ -928,7 +928,7 @@ collate_pending_symbols_by_language (const struct pending *symbol_list) { for (int i = list_counter->nsyms - 1; i >= 0; --i) { - enum language language = SYMBOL_LANGUAGE (list_counter->symbol[i]); + enum language language = list_counter->symbol[i]->language (); nsyms[language].push_back (list_counter->symbol[i]); } } @@ -1116,13 +1116,13 @@ void mdict_add_symbol (struct multidictionary *mdict, struct symbol *sym) { struct dictionary *dict - = find_language_dictionary (mdict, SYMBOL_LANGUAGE (sym)); + = find_language_dictionary (mdict, sym->language ()); if (dict == nullptr) { /* SYM is of a new language that we haven't previously seen. Create a new dictionary for it. */ - dict = create_new_language_dictionary (mdict, SYMBOL_LANGUAGE (sym)); + dict = create_new_language_dictionary (mdict, sym->language ()); } dict_add_symbol (dict, sym); diff --git a/gdb/dwarf-index-write.c b/gdb/dwarf-index-write.c index cbad308..66c2368 100644 --- a/gdb/dwarf-index-write.c +++ b/gdb/dwarf-index-write.c @@ -543,7 +543,7 @@ write_psymbols (struct mapped_symtab *symtab, { struct partial_symbol *psym = *psymp; - if (psym->ginfo.language == language_ada) + if (psym->ginfo.language () == language_ada) error (_("Ada is not currently supported by the index; " "use the DWARF 5 index instead")); @@ -690,7 +690,7 @@ public: return; const char *name = psym->ginfo.search_name (); - if (psym->ginfo.language == language_ada) + if (psym->ginfo.language () == language_ada) { /* We want to ensure that the Ada main function's name appears verbatim in the index. However, this name will be of the diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index e009b52..6a09d55 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -9916,7 +9916,7 @@ fixup_go_packaging (struct dwarf2_cu *cu) { struct symbol *sym = list->symbol[i]; - if (SYMBOL_LANGUAGE (sym) == language_go + if (sym->language () == language_go && SYMBOL_CLASS (sym) == LOC_BLOCK) { char *this_package_name = go_symbol_package_name (sym); diff --git a/gdb/findvar.c b/gdb/findvar.c index 50e99f4..18dd3cd 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -807,7 +807,7 @@ struct value * read_var_value (struct symbol *var, const struct block *var_block, struct frame_info *frame) { - const struct language_defn *lang = language_def (SYMBOL_LANGUAGE (var)); + const struct language_defn *lang = language_def (var->language ()); gdb_assert (lang != NULL); gdb_assert (lang->la_read_var_value != NULL); diff --git a/gdb/ft32-tdep.c b/gdb/ft32-tdep.c index bded02f..56c2165 100644 --- a/gdb/ft32-tdep.c +++ b/gdb/ft32-tdep.c @@ -299,7 +299,7 @@ ft32_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) /* Found a function. */ sym = lookup_symbol (func_name, NULL, VAR_DOMAIN, NULL).symbol; /* Don't use line number debug info for assembly source files. */ - if ((sym != NULL) && SYMBOL_LANGUAGE (sym) != language_asm) + if ((sym != NULL) && sym->language () != language_asm) { sal = find_pc_line (func_addr, 0); if (sal.end && sal.end < func_end) diff --git a/gdb/go-lang.c b/gdb/go-lang.c index bf2eb1b..b527d9f 100644 --- a/gdb/go-lang.c +++ b/gdb/go-lang.c @@ -420,7 +420,7 @@ go_symbol_package_name (const struct symbol *sym) char *name_buf; char *result; - gdb_assert (SYMBOL_LANGUAGE (sym) == language_go); + gdb_assert (sym->language () == language_go); name_buf = unpack_mangled_go_symbol (mangled_name, &package_name, &object_name, &method_type_package_name, diff --git a/gdb/language.h b/gdb/language.h index 5fc25a2..14d6fac 100644 --- a/gdb/language.h +++ b/gdb/language.h @@ -715,7 +715,7 @@ public: { m_lang = current_language->la_language; m_switched = true; - set_language (SYMBOL_LANGUAGE (sym)); + set_language (sym->language ()); } else { diff --git a/gdb/linespec.c b/gdb/linespec.c index 61dcb48..9c17331 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -3683,7 +3683,7 @@ find_method (struct linespec_state *self, std::vector<symtab *> *file_symtabs, gdb_assert (!pspace->executing_startup); set_current_program_space (pspace); t = check_typedef (SYMBOL_TYPE (sym)); - find_methods (t, SYMBOL_LANGUAGE (sym), + find_methods (t, sym->language (), method_name, &result_names, &superclass_vec); /* Handle all items from a single program space at once; and be @@ -3696,7 +3696,7 @@ find_method (struct linespec_state *self, std::vector<symtab *> *file_symtabs, this program space, consider superclasses. */ if (result_names.size () == last_result_len) find_superclass_methods (std::move (superclass_vec), method_name, - SYMBOL_LANGUAGE (sym), &result_names); + sym->language (), &result_names); /* We have a list of candidate symbol names, so now we iterate over the symbol tables looking for all @@ -3998,7 +3998,7 @@ find_label_symbols_in_block (const struct block *block, ALL_BLOCK_SYMBOLS (block, iter, sym) { - if (symbol_matches_domain (SYMBOL_LANGUAGE (sym), + if (symbol_matches_domain (sym->language (), SYMBOL_DOMAIN (sym), LABEL_DOMAIN) && cmp (sym->search_name (), name, name_len) == 0) { diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index f279f13..ceffc01 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -794,11 +794,11 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, /* All functions in C++ have prototypes. For C we don't have enough information in the debug info. */ - if (SYMBOL_LANGUAGE (s) == language_cplus) + if (s->language () == language_cplus) TYPE_PROTOTYPED (SYMBOL_TYPE (s)) = 1; /* Create and enter a new lexical context. */ - b = new_block (FUNCTION_BLOCK, SYMBOL_LANGUAGE (s)); + b = new_block (FUNCTION_BLOCK, s->language ()); SYMBOL_BLOCK_VALUE (s) = b; BLOCK_FUNCTION (b) = s; BLOCK_START (b) = BLOCK_END (b) = sh->value; diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c index 5084331..6cd255d 100644 --- a/gdb/mi/mi-cmd-stack.c +++ b/gdb/mi/mi-cmd-stack.c @@ -543,7 +543,7 @@ list_arg_or_local (const struct frame_arg *arg, enum what_to_list what, get_no_prettyformat_print_options (&opts); opts.deref_ref = 1; common_val_print (arg->val, &stb, 0, &opts, - language_def (SYMBOL_LANGUAGE (arg->sym))); + language_def (arg->sym->language ())); } catch (const gdb_exception_error &except) { diff --git a/gdb/minsyms.c b/gdb/minsyms.c index 40bedbd..6afa393 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -162,7 +162,7 @@ add_minsym_to_demangled_hash_table (struct minimal_symbol *sym, { if (sym->demangled_hash_next == NULL) { - objfile->per_bfd->demangled_hash_languages.set (MSYMBOL_LANGUAGE (sym)); + objfile->per_bfd->demangled_hash_languages.set (sym->language ()); struct minimal_symbol **table = objfile->per_bfd->msymbol_demangled_hash; @@ -1420,8 +1420,7 @@ minimal_symbol_reader::install () build_minimal_symbol_hash_tables. */ if (msym->search_name () != msym->linkage_name ()) hash_values[idx].minsym_demangled_hash - = search_name_hash (MSYMBOL_LANGUAGE (msym), - msym->search_name ()); + = search_name_hash (msym->language (), msym->search_name ()); } { /* To limit how long we hold the lock, we only acquire it here diff --git a/gdb/moxie-tdep.c b/gdb/moxie-tdep.c index 81fdb71..0c38438 100644 --- a/gdb/moxie-tdep.c +++ b/gdb/moxie-tdep.c @@ -232,7 +232,7 @@ moxie_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) sym = lookup_symbol (func_name, NULL, VAR_DOMAIN, NULL).symbol; /* Don't use line number debug info for assembly source files. */ - if (sym && SYMBOL_LANGUAGE (sym) != language_asm) + if (sym && sym->language () != language_asm) { sal = find_pc_line (func_addr, 0); if (sal.end && sal.end < func_end) diff --git a/gdb/parse.c b/gdb/parse.c index d7360aa..399f776 100644 --- a/gdb/parse.c +++ b/gdb/parse.c @@ -1098,7 +1098,7 @@ parse_exp_in_context (const char **stringptr, CORE_ADDR pc, struct symbol *func = block_linkage_function (block); if (func != NULL) - lang = language_def (SYMBOL_LANGUAGE (func)); + lang = language_def (func->language ()); if (lang == NULL || lang->la_language == language_unknown) lang = current_language; } diff --git a/gdb/psymtab.c b/gdb/psymtab.c index 2cbc6d4..28b452b 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -531,7 +531,7 @@ static bool psymbol_name_matches (partial_symbol *psym, const lookup_name_info &lookup_name) { - const language_defn *lang = language_def (psym->ginfo.language); + const language_defn *lang = language_def (psym->ginfo.language ()); symbol_name_matcher_ftype *name_match = get_symbol_name_matcher (lang, lookup_name); return name_match (psym->ginfo.search_name (), lookup_name, NULL); @@ -581,7 +581,7 @@ match_partial_symbol (struct objfile *objfile, center = bottom + (top - bottom) / 2; gdb_assert (center < top); - enum language lang = (*center)->ginfo.language; + enum language lang = (*center)->ginfo.language (); const char *lang_ln = name.language_lookup_name (lang).c_str (); @@ -596,7 +596,7 @@ match_partial_symbol (struct objfile *objfile, while (top <= real_top && psymbol_name_matches (*top, name)) { - if (symbol_matches_domain ((*top)->ginfo.language, + if (symbol_matches_domain ((*top)->ginfo.language (), (*top)->domain, domain)) return *top; top++; @@ -610,7 +610,7 @@ match_partial_symbol (struct objfile *objfile, { for (psym = start; psym < start + length; psym++) { - if (symbol_matches_domain ((*psym)->ginfo.language, + if (symbol_matches_domain ((*psym)->ginfo.language (), (*psym)->domain, domain) && psymbol_name_matches (*psym, name)) return *psym; @@ -719,7 +719,7 @@ lookup_partial_symbol (struct objfile *objfile, while (top <= real_top && symbol_matches_search_name (&(*top)->ginfo, lookup_name)) { - if (symbol_matches_domain ((*top)->ginfo.language, + if (symbol_matches_domain ((*top)->ginfo.language (), (*top)->domain, domain)) return *top; top++; @@ -733,7 +733,7 @@ lookup_partial_symbol (struct objfile *objfile, { for (psym = start; psym < start + length; psym++) { - if (symbol_matches_domain ((*psym)->ginfo.language, + if (symbol_matches_domain ((*psym)->ginfo.language (), (*psym)->domain, domain) && symbol_matches_search_name (&(*psym)->ginfo, lookup_name)) return *psym; @@ -1526,7 +1526,7 @@ psymbol_hash (const void *addr, int length) { unsigned long h = 0; struct partial_symbol *psymbol = (struct partial_symbol *) addr; - unsigned int lang = psymbol->ginfo.language; + unsigned int lang = psymbol->ginfo.language (); unsigned int domain = psymbol->domain; unsigned int theclass = psymbol->aclass; @@ -1553,7 +1553,7 @@ psymbol_compare (const void *addr1, const void *addr2, int length) return (memcmp (&sym1->ginfo.value, &sym2->ginfo.value, sizeof (sym1->ginfo.value)) == 0 - && sym1->ginfo.language == sym2->ginfo.language + && sym1->ginfo.language () == sym2->ginfo.language () && sym1->domain == sym2->domain && sym1->aclass == sym2->aclass /* Note that psymbol names are interned via diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c index 8e38d8d..fd03d31 100644 --- a/gdb/python/py-framefilter.c +++ b/gdb/python/py-framefilter.c @@ -109,7 +109,7 @@ extract_sym (PyObject *obj, gdb::unique_xmalloc_ptr<char> *name, from the symbol. If mode is not "auto", then the language has been explicitly set, use that. */ if (language_mode == language_mode_auto) - *language = language_def (SYMBOL_LANGUAGE (*sym)); + *language = language_def ((*sym)->language ()); else *language = current_language; } @@ -320,7 +320,7 @@ py_print_single_arg (struct ui_out *out, { if (fa->val == NULL && fa->error == NULL) return; - language = language_def (SYMBOL_LANGUAGE (fa->sym)); + language = language_def (fa->sym->language ()); val = fa->val; } else @@ -349,14 +349,14 @@ py_print_single_arg (struct ui_out *out, string_file stb; fprintf_symbol_filtered (&stb, fa->sym->print_name (), - SYMBOL_LANGUAGE (fa->sym), + fa->sym->language (), DMGL_PARAMS | DMGL_ANSI); if (fa->entry_kind == print_entry_values_compact) { stb.puts ("="); fprintf_symbol_filtered (&stb, fa->sym->print_name (), - SYMBOL_LANGUAGE (fa->sym), + fa->sym->language (), DMGL_PARAMS | DMGL_ANSI); } if (fa->entry_kind == print_entry_values_only diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 91a73dd..1b5426e 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -740,7 +740,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, normal: std::string new_name; - if (SYMBOL_LANGUAGE (sym) == language_cplus) + if (sym->language () == language_cplus) { char *name = (char *) alloca (p - string + 1); @@ -758,7 +758,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, SYMBOL_SET_NAMES (sym, gdb::string_view (string, p - string), true, objfile); - if (SYMBOL_LANGUAGE (sym) == language_cplus) + if (sym->language () == language_cplus) cp_scan_for_anonymous_namespaces (get_buildsym_compunit (), sym, objfile); @@ -1225,7 +1225,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, This is important to do, because of forward references: The cleanup of undefined types stored in undef_types only uses STRUCT_DOMAIN symbols to perform the replacement. */ - synonym = (SYMBOL_LANGUAGE (sym) == language_ada && p[-2] != 'T'); + synonym = (sym->language () == language_ada && p[-2] != 'T'); /* Typedef */ SYMBOL_TYPE (sym) = read_type (&p, objfile); diff --git a/gdb/stack.c b/gdb/stack.c index cc7b7e5..2282052 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -428,7 +428,7 @@ print_frame_arg (const frame_print_options &fp_opts, annotate_arg_emitter arg_emitter; ui_out_emit_tuple tuple_emitter (uiout, NULL); fprintf_symbol_filtered (&stb, arg->sym->print_name (), - SYMBOL_LANGUAGE (arg->sym), DMGL_PARAMS | DMGL_ANSI); + arg->sym->language (), DMGL_PARAMS | DMGL_ANSI); if (arg->entry_kind == print_entry_values_compact) { /* It is OK to provide invalid MI-like stream as with @@ -436,7 +436,7 @@ print_frame_arg (const frame_print_options &fp_opts, stb.puts ("="); fprintf_symbol_filtered (&stb, arg->sym->print_name (), - SYMBOL_LANGUAGE (arg->sym), + arg->sym->language (), DMGL_PARAMS | DMGL_ANSI); } if (arg->entry_kind == print_entry_values_only @@ -474,7 +474,7 @@ print_frame_arg (const frame_print_options &fp_opts, /* Use the appropriate language to display our symbol, unless the user forced the language to a specific language. */ if (language_mode == language_mode_auto) - language = language_def (SYMBOL_LANGUAGE (arg->sym)); + language = language_def (arg->sym->language ()); else language = current_language; @@ -1261,7 +1261,7 @@ find_frame_funname (struct frame_info *frame, enum language *funlang, { const char *print_name = func->print_name (); - *funlang = SYMBOL_LANGUAGE (func); + *funlang = func->language (); if (funcp) *funcp = func; if (*funlang == language_cplus) @@ -1291,7 +1291,7 @@ find_frame_funname (struct frame_info *frame, enum language *funlang, if (msymbol.minsym != NULL) { funname.reset (xstrdup (msymbol.minsym->print_name ())); - *funlang = MSYMBOL_LANGUAGE (msymbol.minsym); + *funlang = msymbol.minsym->language (); } } @@ -1495,7 +1495,7 @@ info_frame_command_core (struct frame_info *fi, bool selected_frame_p) if (func) { funname = func->print_name (); - funlang = SYMBOL_LANGUAGE (func); + funlang = func->language (); if (funlang == language_cplus) { /* It seems appropriate to use print_name() here, @@ -1517,7 +1517,7 @@ info_frame_command_core (struct frame_info *fi, bool selected_frame_p) if (msymbol.minsym != NULL) { funname = msymbol.minsym->print_name (); - funlang = MSYMBOL_LANGUAGE (msymbol.minsym); + funlang = msymbol.minsym->language (); } } calling_frame_info = get_prev_frame (fi); diff --git a/gdb/symfile.c b/gdb/symfile.c index 8852e28..5ca89b4 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -1697,7 +1697,7 @@ set_initial_language (void) struct symbol *sym = lookup_symbol (name, NULL, VAR_DOMAIN, NULL).symbol; if (sym != NULL) - lang = SYMBOL_LANGUAGE (sym); + lang = sym->language (); } if (lang == language_unknown) diff --git a/gdb/symtab.c b/gdb/symtab.c index 6fd1c8c..a082ee2 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -675,7 +675,7 @@ symbol_set_demangled_name (struct general_symbol_info *gsymbol, const char *name, struct obstack *obstack) { - if (gsymbol->language == language_ada) + if (gsymbol->language () == language_ada) { if (name == NULL) { @@ -697,7 +697,7 @@ symbol_set_demangled_name (struct general_symbol_info *gsymbol, const char * symbol_get_demangled_name (const struct general_symbol_info *gsymbol) { - if (gsymbol->language == language_ada) + if (gsymbol->language () == language_ada) { if (!gsymbol->ada_mangled) return NULL; @@ -716,16 +716,16 @@ symbol_set_language (struct general_symbol_info *gsymbol, enum language language, struct obstack *obstack) { - gsymbol->language = language; - if (gsymbol->language == language_cplus - || gsymbol->language == language_d - || gsymbol->language == language_go - || gsymbol->language == language_objc - || gsymbol->language == language_fortran) + gsymbol->m_language = language; + if (language == language_cplus + || language == language_d + || language == language_go + || language == language_objc + || language == language_fortran) { symbol_set_demangled_name (gsymbol, NULL, obstack); } - else if (gsymbol->language == language_ada) + else if (language == language_ada) { gdb_assert (gsymbol->ada_mangled == 0); gsymbol->language_specific.obstack = obstack; @@ -819,12 +819,12 @@ symbol_find_demangled_name (struct general_symbol_info *gsymbol, char *demangled = NULL; int i; - if (gsymbol->language == language_unknown) - gsymbol->language = language_auto; + if (gsymbol->language () == language_unknown) + gsymbol->m_language = language_auto; - if (gsymbol->language != language_auto) + if (gsymbol->language () != language_auto) { - const struct language_defn *lang = language_def (gsymbol->language); + const struct language_defn *lang = language_def (gsymbol->language ()); language_sniff_from_mangled_name (lang, mangled, &demangled); return demangled; @@ -837,7 +837,7 @@ symbol_find_demangled_name (struct general_symbol_info *gsymbol, if (language_sniff_from_mangled_name (lang, mangled, &demangled)) { - gsymbol->language = l; + gsymbol->m_language = l; return demangled; } } @@ -864,7 +864,7 @@ symbol_set_names (struct general_symbol_info *gsymbol, { struct demangled_name_entry **slot; - if (gsymbol->language == language_ada) + if (gsymbol->language () == language_ada) { /* In Ada, we do the symbol lookups using the mangled name, so we can save some space by not storing the demangled name. */ @@ -898,7 +898,7 @@ symbol_set_names (struct general_symbol_info *gsymbol, if (*slot == NULL /* A C version of the symbol may have already snuck into the table. This happens to, e.g., main.init (__go_init_main). Cope. */ - || (gsymbol->language == language_go && (*slot)->demangled == nullptr)) + || (gsymbol->language () == language_go && (*slot)->demangled == nullptr)) { /* A 0-terminated copy of the linkage name. Callers must set COPY_NAME to true if the string might not be nullterminated. We have to make @@ -959,11 +959,11 @@ symbol_set_names (struct general_symbol_info *gsymbol, (gdb::string_view (mangled_ptr, linkage_name.length ())); } (*slot)->demangled = std::move (demangled_name); - (*slot)->language = gsymbol->language; + (*slot)->language = gsymbol->language (); } - else if (gsymbol->language == language_unknown - || gsymbol->language == language_auto) - gsymbol->language = (*slot)->language; + else if (gsymbol->language () == language_unknown + || gsymbol->language () == language_auto) + gsymbol->m_language = (*slot)->language; gsymbol->name = (*slot)->mangled.data (); if ((*slot)->demangled != nullptr) @@ -978,7 +978,7 @@ symbol_set_names (struct general_symbol_info *gsymbol, const char * general_symbol_info::natural_name () const { - switch (language) + switch (language ()) { case language_cplus: case language_d: @@ -1003,7 +1003,7 @@ general_symbol_info::demangled_name () const { const char *dem_name = NULL; - switch (language) + switch (language ()) { case language_cplus: case language_d: @@ -1026,7 +1026,7 @@ general_symbol_info::demangled_name () const const char * general_symbol_info::search_name () const { - if (language == language_ada) + if (language () == language_ada) return name; else return natural_name (); @@ -1039,7 +1039,7 @@ symbol_matches_search_name (const struct general_symbol_info *gsymbol, const lookup_name_info &name) { symbol_name_matcher_ftype *name_match - = get_symbol_name_matcher (language_def (gsymbol->language), name); + = get_symbol_name_matcher (language_def (gsymbol->language ()), name); return name_match (gsymbol->search_name (), name, NULL); } @@ -1219,8 +1219,7 @@ eq_symbol_entry (const struct symbol_cache_slot *slot, if (!SYMBOL_MATCHES_SEARCH_NAME (sym, lookup_name)) return 0; - if (!symbol_matches_domain (SYMBOL_LANGUAGE (sym), - slot_domain, domain)) + if (!symbol_matches_domain (sym->language (), slot_domain, domain)) return 0; } } @@ -2846,8 +2845,7 @@ iterate_over_symbols (const struct block *block, ALL_BLOCK_SYMBOLS_WITH_NAME (block, name, iter, sym) { - if (symbol_matches_domain (SYMBOL_LANGUAGE (sym), - SYMBOL_DOMAIN (sym), domain)) + if (symbol_matches_domain (sym->language (), SYMBOL_DOMAIN (sym), domain)) { struct block_symbol block_sym = {sym, block}; @@ -5262,7 +5260,7 @@ completion_list_add_symbol (completion_tracker &tracker, const lookup_name_info &lookup_name, const char *text, const char *word) { - completion_list_add_name (tracker, SYMBOL_LANGUAGE (sym), + completion_list_add_name (tracker, sym->language (), sym->natural_name (), lookup_name, text, word); } @@ -5275,7 +5273,7 @@ completion_list_add_msymbol (completion_tracker &tracker, const lookup_name_info &lookup_name, const char *text, const char *word) { - completion_list_add_name (tracker, MSYMBOL_LANGUAGE (sym), + completion_list_add_name (tracker, sym->language (), sym->natural_name (), lookup_name, text, word); } @@ -5409,7 +5407,7 @@ completion_list_add_fields (completion_tracker &tracker, if (c == TYPE_CODE_UNION || c == TYPE_CODE_STRUCT) for (j = TYPE_N_BASECLASSES (t); j < TYPE_NFIELDS (t); j++) if (TYPE_FIELD_NAME (t, j)) - completion_list_add_name (tracker, SYMBOL_LANGUAGE (sym), + completion_list_add_name (tracker, sym->language (), TYPE_FIELD_NAME (t, j), lookup_name, text, word); } diff --git a/gdb/symtab.h b/gdb/symtab.h index e8321d4..09e2a20 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -425,6 +425,9 @@ struct general_symbol_info void set_linkage_name (const char *linkage_name) { name = linkage_name; } + enum language language () const + { return m_language; } + /* Name of the symbol. This is a required field. Storage for the name is allocated on the objfile_obstack for the associated objfile. For languages like C++ that make a distinction between @@ -479,7 +482,7 @@ struct general_symbol_info This is used to select one of the fields from the language specific union above. */ - ENUM_BITFIELD(language) language : LANGUAGE_BITS; + ENUM_BITFIELD(language) m_language : LANGUAGE_BITS; /* This is only used by Ada. If set, then the 'demangled_name' field of language_specific is valid. Otherwise, the 'obstack' field is @@ -522,7 +525,6 @@ extern CORE_ADDR get_symbol_address (const struct symbol *sym); #define SYMBOL_VALUE_COMMON_BLOCK(symbol) (symbol)->value.common_block #define SYMBOL_BLOCK_VALUE(symbol) (symbol)->value.block #define SYMBOL_VALUE_CHAIN(symbol) (symbol)->value.chain -#define SYMBOL_LANGUAGE(symbol) (symbol)->language #define SYMBOL_SECTION(symbol) (symbol)->section #define SYMBOL_OBJ_SECTION(objfile, symbol) \ (((symbol)->section >= 0) \ @@ -741,7 +743,6 @@ extern CORE_ADDR get_msymbol_address (struct objfile *objf, #define MSYMBOL_VALUE_BYTES(symbol) (symbol)->value.bytes #define MSYMBOL_BLOCK_VALUE(symbol) (symbol)->value.block #define MSYMBOL_VALUE_CHAIN(symbol) (symbol)->value.chain -#define MSYMBOL_LANGUAGE(symbol) (symbol)->language #define MSYMBOL_SECTION(symbol) (symbol)->section #define MSYMBOL_OBJ_SECTION(objfile, symbol) \ (((symbol)->section >= 0) \ @@ -1098,7 +1099,7 @@ struct symbol : public general_symbol_info, public allocate_on_obstack name = nullptr; value.ivalue = 0; language_specific.obstack = nullptr; - language = language_unknown; + m_language = language_unknown; ada_mangled = 0; section = 0; /* GCC 4.8.5 (on CentOS 7) does not correctly compile class- diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c index 9b8b7e2..52a6f3e 100644 --- a/gdb/xstormy16-tdep.c +++ b/gdb/xstormy16-tdep.c @@ -430,7 +430,7 @@ xstormy16_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) /* Found a function. */ sym = lookup_symbol (func_name, NULL, VAR_DOMAIN, NULL).symbol; /* Don't use line number debug info for assembly source files. */ - if (sym && SYMBOL_LANGUAGE (sym) != language_asm) + if (sym && sym->language () != language_asm) { sal = find_pc_line (func_addr, 0); if (sal.end && sal.end < func_end) |