From 33e5013ed29270c3b6c5eaf46225e66b0fb6bc2c Mon Sep 17 00:00:00 2001 From: Sami Wagiaalla Date: Mon, 9 Aug 2010 19:42:48 +0000 Subject: [PATCH] create and use symbol_set_language. 2010-08-09 Sami Wagiaalla * symtab.h: Renamed SYMBOL_INIT_LANGUAGE_SPECIFIC to SYMBOL_SET_LANGUAGE. (symbol_init_language_specific): Renamed to symbol_set_language. * symtab.c (symbol_init_language_specific): Removed redundant check for language_cplus. Renamed to symbol_set_language. * stabsread.c (define_symbol): Updated. (read_enum_type): Updated * psymtab.c (add_psymbol_to_bcache): Updated. * minsyms.c (install_minimal_symbols): Updated. * coffread.c (process_coff_symbol): SYMBOL_SET_LANGUAGE instead of SYMBOL_LANGUAGE to set the language. * minsyms.c (prim_record_minimal_symbol_full): Ditto. * mdebugread.c (new_symbol): Ditto. * cp-namespace.c (check_one_possible_namespace_symbol): Ditto. * dwarf2read.c (new_symbol_full): Ditto. * jv-lang.c (add_class_symbol): Ditto. --- gdb/ChangeLog | 20 ++++++++++++++++++++ gdb/coffread.c | 2 +- gdb/cp-namespace.c | 2 +- gdb/dwarf2read.c | 2 +- gdb/jv-lang.c | 2 +- gdb/mdebugread.c | 2 +- gdb/minsyms.c | 5 ++--- gdb/objfiles.c | 2 +- gdb/psymtab.c | 2 +- gdb/stabsread.c | 4 ++-- gdb/symtab.c | 8 +++----- gdb/symtab.h | 10 +++++----- 12 files changed, 39 insertions(+), 22 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 966b3da..aa4bd19 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,23 @@ +2010-08-09 Sami Wagiaalla + + * symtab.h: Renamed SYMBOL_INIT_LANGUAGE_SPECIFIC to + SYMBOL_SET_LANGUAGE. + (symbol_init_language_specific): Renamed to symbol_set_language. + * symtab.c (symbol_init_language_specific): Removed redundant check + for language_cplus. + Renamed to symbol_set_language. + * stabsread.c (define_symbol): Updated. + (read_enum_type): Updated + * psymtab.c (add_psymbol_to_bcache): Updated. + * minsyms.c (install_minimal_symbols): Updated. + * coffread.c (process_coff_symbol): SYMBOL_SET_LANGUAGE instead of + SYMBOL_LANGUAGE to set the language. + * minsyms.c (prim_record_minimal_symbol_full): Ditto. + * mdebugread.c (new_symbol): Ditto. + * cp-namespace.c (check_one_possible_namespace_symbol): Ditto. + * dwarf2read.c (new_symbol_full): Ditto. + * jv-lang.c (add_class_symbol): Ditto. + 2010-08-07 Jan Kratochvil * defs.h (make_cleanup_restore_uinteger, make_cleanup_restore_ui_file) diff --git a/gdb/coffread.c b/gdb/coffread.c index 52417b2..85e8140 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -1512,7 +1512,7 @@ process_coff_symbol (struct coff_symbol *cs, memset (sym, 0, sizeof (struct symbol)); name = cs->c_name; name = EXTERNAL_NAME (name, objfile->obfd); - SYMBOL_LANGUAGE (sym) = current_subfile->language; + SYMBOL_SET_LANGUAGE (sym, current_subfile->language); SYMBOL_SET_NAMES (sym, name, strlen (name), 1, objfile); /* default assumptions */ diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c index 49ada64..16f58ca 100644 --- a/gdb/cp-namespace.c +++ b/gdb/cp-namespace.c @@ -938,7 +938,7 @@ check_one_possible_namespace_symbol (const char *name, int len, sym = obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol)); memset (sym, 0, sizeof (struct symbol)); - SYMBOL_LANGUAGE (sym) = language_cplus; + SYMBOL_SET_LANGUAGE (sym, language_cplus); /* Note that init_type copied the name to the objfile's obstack. */ SYMBOL_SET_NAMES (sym, TYPE_NAME (type), len, 0, objfile); diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 5275c58..aecd042 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -10013,7 +10013,7 @@ new_symbol_full (struct die_info *die, struct type *type, struct dwarf2_cu *cu, OBJSTAT (objfile, n_syms++); /* Cache this symbol's name and the name's demangled form (if any). */ - SYMBOL_LANGUAGE (sym) = cu->language; + SYMBOL_SET_LANGUAGE (sym, cu->language); linkagename = dwarf2_physname (name, die, cu); SYMBOL_SET_NAMES (sym, linkagename, strlen (linkagename), 0, objfile); diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c index 53fd9a2..c5f98bd 100644 --- a/gdb/jv-lang.c +++ b/gdb/jv-lang.c @@ -162,7 +162,7 @@ add_class_symbol (struct type *type, CORE_ADDR addr) sym = (struct symbol *) obstack_alloc (&dynamics_objfile->objfile_obstack, sizeof (struct symbol)); memset (sym, 0, sizeof (struct symbol)); - SYMBOL_LANGUAGE (sym) = language_java; + SYMBOL_SET_LANGUAGE (sym, language_java); SYMBOL_SET_LINKAGE_NAME (sym, TYPE_TAG_NAME (type)); SYMBOL_CLASS (sym) = LOC_TYPEDEF; /* SYMBOL_VALUE (sym) = valu; */ diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index 2e18fa4..0467816 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -4794,7 +4794,7 @@ new_symbol (char *name) sizeof (struct symbol))); memset (s, 0, sizeof (*s)); - SYMBOL_LANGUAGE (s) = psymtab_language; + SYMBOL_SET_LANGUAGE (s, psymtab_language); SYMBOL_SET_NAMES (s, name, strlen (name), 1, current_objfile); return s; } diff --git a/gdb/minsyms.c b/gdb/minsyms.c index cb4545c..0a57e77 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -833,8 +833,7 @@ prim_record_minimal_symbol_full (const char *name, int name_len, int copy_name, msym_bunch = new; } msymbol = &msym_bunch->contents[msym_bunch_index]; - SYMBOL_INIT_LANGUAGE_SPECIFIC (msymbol, language_unknown); - SYMBOL_LANGUAGE (msymbol) = language_auto; + SYMBOL_SET_LANGUAGE (msymbol, language_auto); SYMBOL_SET_NAMES (msymbol, name, name_len, copy_name, objfile); SYMBOL_VALUE_ADDRESS (msymbol) = address; @@ -1145,7 +1144,7 @@ install_minimal_symbols (struct objfile *objfile) MSYMBOL_TARGET_FLAG_2 (&msymbols[mcount]) = 0; MSYMBOL_SIZE (&msymbols[mcount]) = 0; MSYMBOL_TYPE (&msymbols[mcount]) = mst_unknown; - SYMBOL_INIT_LANGUAGE_SPECIFIC (&msymbols[mcount], language_unknown); + SYMBOL_SET_LANGUAGE (&msymbols[mcount], language_unknown); /* Attach the minimal symbol table to the specified objfile. The strings themselves are also located in the objfile_obstack diff --git a/gdb/objfiles.c b/gdb/objfiles.c index c67c164..b522189 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -376,7 +376,7 @@ terminate_minimal_symbol_table (struct objfile *objfile) memset (m, 0, sizeof (*m)); /* Don't rely on these enumeration values being 0's. */ MSYMBOL_TYPE (m) = mst_unknown; - SYMBOL_INIT_LANGUAGE_SPECIFIC (m, language_unknown); + SYMBOL_SET_LANGUAGE (m, language_unknown); } } diff --git a/gdb/psymtab.c b/gdb/psymtab.c index c120894..bc47681 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -1304,7 +1304,7 @@ add_psymbol_to_bcache (char *name, int namelength, int copy_name, SYMBOL_VALUE_ADDRESS (&psymbol) = coreaddr; } SYMBOL_SECTION (&psymbol) = 0; - SYMBOL_LANGUAGE (&psymbol) = language; + SYMBOL_SET_LANGUAGE (&psymbol, language); PSYMBOL_DOMAIN (&psymbol) = domain; PSYMBOL_CLASS (&psymbol) = class; diff --git a/gdb/stabsread.c b/gdb/stabsread.c index b62156c..5f6b004 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -704,7 +704,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, else { normal: - SYMBOL_LANGUAGE (sym) = current_subfile->language; + SYMBOL_SET_LANGUAGE (sym, current_subfile->language); if (SYMBOL_LANGUAGE (sym) == language_cplus) { char *name = alloca (p - string + 1); @@ -3656,7 +3656,7 @@ read_enum_type (char **pp, struct type *type, obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol)); memset (sym, 0, sizeof (struct symbol)); SYMBOL_SET_LINKAGE_NAME (sym, name); - SYMBOL_LANGUAGE (sym) = current_subfile->language; + SYMBOL_SET_LANGUAGE (sym, current_subfile->language); SYMBOL_CLASS (sym) = LOC_CONST; SYMBOL_DOMAIN (sym) = VAR_DOMAIN; SYMBOL_VALUE (sym) = n; diff --git a/gdb/symtab.c b/gdb/symtab.c index 1c05648..5fbe58c 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -393,13 +393,11 @@ symbol_get_demangled_name (const struct general_symbol_info *gsymbol) /* Initialize the language dependent portion of a symbol depending upon the language for the symbol. */ void -symbol_init_language_specific (struct general_symbol_info *gsymbol, - enum language language) +symbol_set_language (struct general_symbol_info *gsymbol, + enum language language) { - gsymbol->language = language; - if (gsymbol->language == language_cplus - || gsymbol->language == language_d + if (gsymbol->language == language_d || gsymbol->language == language_java || gsymbol->language == language_objc || gsymbol->language == language_fortran) diff --git a/gdb/symtab.h b/gdb/symtab.h index de6f188..04cb443 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -171,7 +171,7 @@ extern CORE_ADDR symbol_overlayed_address (CORE_ADDR, struct obj_section *); /* Note that all the following SYMBOL_* macros are used with the SYMBOL argument being either a partial symbol, a minimal symbol or a full symbol. All three types have a ginfo field. In particular - the SYMBOL_INIT_LANGUAGE_SPECIFIC, SYMBOL_DEMANGLED_NAME, etc. + the SYMBOL_SET_LANGUAGE, SYMBOL_DEMANGLED_NAME, etc. macros cannot be entirely substituted by functions, unless the callers are changed to pass in the ginfo field only, instead of the SYMBOL parameter. */ @@ -187,10 +187,10 @@ extern CORE_ADDR symbol_overlayed_address (CORE_ADDR, struct obj_section *); /* Initializes the language dependent portion of a symbol depending upon the language for the symbol. */ -#define SYMBOL_INIT_LANGUAGE_SPECIFIC(symbol,language) \ - (symbol_init_language_specific (&(symbol)->ginfo, (language))) -extern void symbol_init_language_specific (struct general_symbol_info *symbol, - enum language language); +#define SYMBOL_SET_LANGUAGE(symbol,language) \ + (symbol_set_language (&(symbol)->ginfo, (language))) +extern void symbol_set_language (struct general_symbol_info *symbol, + enum language language); /* Set just the linkage name of a symbol; do not try to demangle it. Used for constructs which do not have a mangled name, -- 2.7.4