diff options
-rw-r--r-- | gdb/ChangeLog | 60 | ||||
-rw-r--r-- | gdb/ax-gdb.c | 2 | ||||
-rw-r--r-- | gdb/blockframe.c | 10 | ||||
-rw-r--r-- | gdb/buildsym.c | 2 | ||||
-rw-r--r-- | gdb/c-valprint.c | 2 | ||||
-rw-r--r-- | gdb/coffread.c | 25 | ||||
-rw-r--r-- | gdb/cp-support.c | 6 | ||||
-rw-r--r-- | gdb/cp-support.h | 2 | ||||
-rw-r--r-- | gdb/dwarf2read.c | 6 | ||||
-rw-r--r-- | gdb/expprint.c | 2 | ||||
-rw-r--r-- | gdb/f-valprint.c | 14 | ||||
-rw-r--r-- | gdb/findvar.c | 2 | ||||
-rw-r--r-- | gdb/gnu-v2-abi.c | 2 | ||||
-rw-r--r-- | gdb/hppa-hpux-tdep.c | 10 | ||||
-rw-r--r-- | gdb/jv-lang.c | 2 | ||||
-rw-r--r-- | gdb/linespec.c | 4 | ||||
-rw-r--r-- | gdb/mdebugread.c | 14 | ||||
-rw-r--r-- | gdb/minsyms.c | 19 | ||||
-rw-r--r-- | gdb/objfiles.h | 2 | ||||
-rw-r--r-- | gdb/printcmd.c | 8 | ||||
-rw-r--r-- | gdb/sol-thread.c | 4 | ||||
-rw-r--r-- | gdb/stabsread.c | 86 | ||||
-rw-r--r-- | gdb/stack.c | 76 | ||||
-rw-r--r-- | gdb/symmisc.c | 22 | ||||
-rw-r--r-- | gdb/symtab.h | 21 | ||||
-rw-r--r-- | gdb/tracepoint.c | 34 | ||||
-rw-r--r-- | gdb/typeprint.c | 4 | ||||
-rw-r--r-- | gdb/xcoffread.c | 2 |
28 files changed, 248 insertions, 195 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b4626418a04..fcd482bdfc1 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,63 @@ +2008-08-21 Daniel Jacobowitz <dan@codesourcery.com> + + * ax-gdb.c (gen_var_ref): Use SYMBOL_LINKAGE_NAME. + * blockframe.c (find_pc_partial_function): Likewise. + * buildsym.c (find_symbol_in_list): Likewise. + * c-valprint.c (c_val_print): Likewise. + * coffread.c (patch_opaque_types, process_coff_symbol): Likewise. + (coff_read_enum_type): Likewise. Use SYMBOL_SET_LINKAGE_NAME. + * cp-support.c (cp_remove_params): Renamed from remove_params and + made global. + (overload_list_add_symbol): Update call to remove_params. + * cp-support.h (cp_remove_params): Declare. + * dwarf2read.c (process_enumeration_scope): Use SYMBOL_LINKAGE_NAME. + (dwarf2_const_value): Use SYMBOL_PRINT_NAME. + * expprint.c (dump_subexp_body_standard): Likewise. + * f-valprint.c (info_common_command, there_is_a_visible_common_named): + Use SYMBOL_LINKAGE_NAME to find symbols and SYMBOL_PRINT_NAME + for messages. + * findvar.c (read_var_value): Use SYMBOL_LINKAGE_NAME. + * gnu-v2-abi.c (gnuv2_value_rtti_type): Likewise. + * hppa-hpux-tdep.c (hppa32_hpux_in_solib_call_trampoline) + (hppa_hpux_skip_trampoline_code): Use SYMBOL_LINKAGE_NAME to find + symbols and SYMBOL_PRINT_NAME for messages. + * jv-lang.c (add_class_symbol): Use SYMBOL_SET_LINKAGE_NAME. + * linespec.c (decode_line_2): Use SYMBOL_LINKAGE_NAME. + * mdebugread.c (parse_symbol): Use SYMBOL_LINKAGE_NAME and + SYMBOL_SET_LINKAGE_NAME. + (mylookup_symbol): Use SYMBOL_LINKAGE_NAME. + * minsyms.c (add_minsym_to_demangled_hash_table): Use + SYMBOL_SEARCH_NAME. + (lookup_minimal_symbol): Use SYMBOL_LINKAGE_NAME or + SYMBOL_MATCHES_SEARCH_NAME, depending on the pass. + * objfiles.h (ALL_OBJFILE_MSYMBOLS): Use SYMBOL_LINKAGE_NAME. + * printcmd.c (build_address_symbolic): Use SYMBOL_LINKAGE_NAME. + (address_info): Use SYMBOL_PRINT_NAME for messages and + SYMBOL_LINKAGE_NAME for lookups. + * sol-thread.c (info_cb): Use SYMBOL_PRINT_NAME for messages. + * stabsread.c (patch_block_stabs, define_symbol) + (read_type, read_enum_type, common_block_end) + (cleanup_undefined_types_1, scan_file_globals): Use + SYMBOL_LINKAGE_NAME, SYMBOL_SET_LINKAGE_NAME, ALL_OBJFILE_MSYMBOLS, + and SYMBOL_PRINT_NAME. + * stack.c (print_frame_args): Use SYMBOL_LINKAGE_NAME. + (print_frame, frame_info): Use SYMBOL_PRINT_NAME for output. Use + cp_remove_params instead of cplus_demangle. + (print_block_frame_labels, print_frame_arg_vars): Use + SYMBOL_LINKAGE_NAME. + * symmisc.c (dump_msymbols): Use ALL_OBJFILE_MSYMBOLS and + SYMBOL_LINKAGE_NAME. + (dump_symtab_1, print_symbol, print_partial_symbols) + (maintenance_check_symtabs): Use SYMBOL_LINKAGE_NAME. + * symtab.h (DEPRECATED_SYMBOL_NAME): Delete. + (SYMBOL_SET_LINKAGE_NAME): New. + (SYMBOL_SET_NAMES): Add a comment. + * tracepoint.c (set_traceframe_context, validate_actionline) + (collect_symbol, scope_info): Use SYMBOL_LINKAGE_NAME for + lookups and SYMBOL_PRINT_NAME for output. + * typeprint.c (typedef_print): Use SYMBOL_LINKAGE_NAME. + * xcoffread.c (process_xcoff_symbol): Use SYMBOL_SET_LINKAGE_NAME. + 2008-08-21 Pedro Alves <pedro@codesourcery.com> * arm-tdep.c (arm_pc_is_thumb): Use obj_section_addr. diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c index 09bf42cd7fb..80e8aaf52ac 100644 --- a/gdb/ax-gdb.c +++ b/gdb/ax-gdb.c @@ -599,7 +599,7 @@ gen_var_ref (struct agent_expr *ax, struct axs_value *value, struct symbol *var) case LOC_UNRESOLVED: { struct minimal_symbol *msym - = lookup_minimal_symbol (DEPRECATED_SYMBOL_NAME (var), NULL, NULL); + = lookup_minimal_symbol (SYMBOL_LINKAGE_NAME (var), NULL, NULL); if (!msym) error (_("Couldn't resolve symbol `%s'."), SYMBOL_PRINT_NAME (var)); diff --git a/gdb/blockframe.c b/gdb/blockframe.c index 44d2a2a6075..3d4bc190797 100644 --- a/gdb/blockframe.c +++ b/gdb/blockframe.c @@ -223,7 +223,7 @@ find_pc_partial_function (CORE_ADDR pc, char **name, CORE_ADDR *address, { cache_pc_function_low = BLOCK_START (SYMBOL_BLOCK_VALUE (f)); cache_pc_function_high = BLOCK_END (SYMBOL_BLOCK_VALUE (f)); - cache_pc_function_name = DEPRECATED_SYMBOL_NAME (f); + cache_pc_function_name = SYMBOL_LINKAGE_NAME (f); cache_pc_function_section = section; goto return_cached_value; } @@ -244,7 +244,7 @@ find_pc_partial_function (CORE_ADDR pc, char **name, CORE_ADDR *address, if (address) *address = SYMBOL_VALUE_ADDRESS (psb); if (name) - *name = DEPRECATED_SYMBOL_NAME (psb); + *name = SYMBOL_LINKAGE_NAME (psb); /* endaddr non-NULL can't happen here. */ return 1; } @@ -275,7 +275,7 @@ find_pc_partial_function (CORE_ADDR pc, char **name, CORE_ADDR *address, } cache_pc_function_low = SYMBOL_VALUE_ADDRESS (msymbol); - cache_pc_function_name = DEPRECATED_SYMBOL_NAME (msymbol); + cache_pc_function_name = SYMBOL_LINKAGE_NAME (msymbol); cache_pc_function_section = section; /* If the minimal symbol has a size, use it for the cache. @@ -291,14 +291,14 @@ find_pc_partial_function (CORE_ADDR pc, char **name, CORE_ADDR *address, other sections, to find the next symbol in this section with a different address. */ - for (i = 1; DEPRECATED_SYMBOL_NAME (msymbol + i) != NULL; i++) + for (i = 1; SYMBOL_LINKAGE_NAME (msymbol + i) != NULL; i++) { if (SYMBOL_VALUE_ADDRESS (msymbol + i) != SYMBOL_VALUE_ADDRESS (msymbol) && SYMBOL_BFD_SECTION (msymbol + i) == SYMBOL_BFD_SECTION (msymbol)) break; } - if (DEPRECATED_SYMBOL_NAME (msymbol + i) != NULL + if (SYMBOL_LINKAGE_NAME (msymbol + i) != NULL && SYMBOL_VALUE_ADDRESS (msymbol + i) < obj_section_endaddr (osect)) cache_pc_function_high = SYMBOL_VALUE_ADDRESS (msymbol + i); else diff --git a/gdb/buildsym.c b/gdb/buildsym.c index e8bf973f810..686e600c7c7 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -168,7 +168,7 @@ find_symbol_in_list (struct pending *list, char *name, int length) { for (j = list->nsyms; --j >= 0;) { - pp = DEPRECATED_SYMBOL_NAME (list->symbol[j]); + pp = SYMBOL_LINKAGE_NAME (list->symbol[j]); if (*pp == *name && strncmp (pp, name, length) == 0 && pp[length] == '\0') { diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c index cf35e889545..30a1be74076 100644 --- a/gdb/c-valprint.c +++ b/gdb/c-valprint.c @@ -261,7 +261,7 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, int is_this_fld; if (msymbol != NULL) - wsym = lookup_symbol (DEPRECATED_SYMBOL_NAME (msymbol), block, + wsym = lookup_symbol (SYMBOL_LINKAGE_NAME (msymbol), block, VAR_DOMAIN, &is_this_fld); if (wsym) diff --git a/gdb/coffread.c b/gdb/coffread.c index e6cc38951a3..3717d02e3c4 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -1429,15 +1429,15 @@ patch_opaque_types (struct symtab *s) TYPE_CODE (SYMBOL_TYPE (real_sym)) == TYPE_CODE_PTR && TYPE_LENGTH (TYPE_TARGET_TYPE (SYMBOL_TYPE (real_sym))) != 0) { - char *name = DEPRECATED_SYMBOL_NAME (real_sym); + char *name = SYMBOL_LINKAGE_NAME (real_sym); int hash = hashname (name); struct symbol *sym, *prev; prev = 0; for (sym = opaque_type_chain[hash]; sym;) { - if (name[0] == DEPRECATED_SYMBOL_NAME (sym)[0] && - strcmp (name + 1, DEPRECATED_SYMBOL_NAME (sym) + 1) == 0) + if (name[0] == SYMBOL_LINKAGE_NAME (sym)[0] && + strcmp (name + 1, SYMBOL_LINKAGE_NAME (sym) + 1) == 0) { if (prev) { @@ -1604,7 +1604,7 @@ process_coff_symbol (struct coff_symbol *cs, } else TYPE_NAME (SYMBOL_TYPE (sym)) = - concat (DEPRECATED_SYMBOL_NAME (sym), (char *)NULL); + concat (SYMBOL_LINKAGE_NAME (sym), (char *)NULL); } /* Keep track of any type which points to empty structured type, @@ -1617,7 +1617,7 @@ process_coff_symbol (struct coff_symbol *cs, TYPE_CODE (TYPE_TARGET_TYPE (SYMBOL_TYPE (sym))) != TYPE_CODE_UNDEF) { - int i = hashname (DEPRECATED_SYMBOL_NAME (sym)); + int i = hashname (SYMBOL_LINKAGE_NAME (sym)); SYMBOL_VALUE_CHAIN (sym) = opaque_type_chain[i]; opaque_type_chain[i] = sym; @@ -1635,11 +1635,11 @@ process_coff_symbol (struct coff_symbol *cs, names for anonymous enums, structures, and unions, like "~0fake" or ".0fake". Thanks, but no thanks... */ if (TYPE_TAG_NAME (SYMBOL_TYPE (sym)) == 0) - if (DEPRECATED_SYMBOL_NAME (sym) != NULL - && *DEPRECATED_SYMBOL_NAME (sym) != '~' - && *DEPRECATED_SYMBOL_NAME (sym) != '.') + if (SYMBOL_LINKAGE_NAME (sym) != NULL + && *SYMBOL_LINKAGE_NAME (sym) != '~' + && *SYMBOL_LINKAGE_NAME (sym) != '.') TYPE_TAG_NAME (SYMBOL_TYPE (sym)) = - concat (DEPRECATED_SYMBOL_NAME (sym), (char *)NULL); + concat (SYMBOL_LINKAGE_NAME (sym), (char *)NULL); add_symbol_to_list (sym, &file_symbols); break; @@ -2031,8 +2031,9 @@ coff_read_enum_type (int index, int length, int lastsym, (&objfile->objfile_obstack, sizeof (struct symbol)); memset (sym, 0, sizeof (struct symbol)); - DEPRECATED_SYMBOL_NAME (sym) = - obsavestring (name, strlen (name), &objfile->objfile_obstack); + SYMBOL_SET_LINKAGE_NAME (sym, + obsavestring (name, strlen (name), + &objfile->objfile_obstack)); SYMBOL_CLASS (sym) = LOC_CONST; SYMBOL_DOMAIN (sym) = VAR_DOMAIN; SYMBOL_VALUE (sym) = ms->c_value; @@ -2078,7 +2079,7 @@ coff_read_enum_type (int index, int length, int lastsym, { struct symbol *xsym = syms->symbol[j]; SYMBOL_TYPE (xsym) = type; - TYPE_FIELD_NAME (type, n) = DEPRECATED_SYMBOL_NAME (xsym); + TYPE_FIELD_NAME (type, n) = SYMBOL_LINKAGE_NAME (xsym); TYPE_FIELD_BITPOS (type, n) = SYMBOL_VALUE (xsym); if (SYMBOL_VALUE (xsym) < 0) unsigned_enum = 0; diff --git a/gdb/cp-support.c b/gdb/cp-support.c index e478f42e4f2..df48f6021db 100644 --- a/gdb/cp-support.c +++ b/gdb/cp-support.c @@ -377,8 +377,8 @@ cp_func_name (const char *full_name) (optionally) a return type. Return the name of the function without parameters or return type, or NULL if we can not parse the name. */ -static char * -remove_params (const char *demangled_name) +char * +cp_remove_params (const char *demangled_name) { int done = 0; struct demangle_component *ret_comp; @@ -649,7 +649,7 @@ overload_list_add_symbol (struct symbol *sym, const char *oload_name) return; /* Get the demangled name without parameters */ - sym_name = remove_params (SYMBOL_NATURAL_NAME (sym)); + sym_name = cp_remove_params (SYMBOL_NATURAL_NAME (sym)); if (!sym_name) return; diff --git a/gdb/cp-support.h b/gdb/cp-support.h index 8c0119ee8d5..8e55733fe08 100644 --- a/gdb/cp-support.h +++ b/gdb/cp-support.h @@ -64,6 +64,8 @@ extern unsigned int cp_entire_prefix_len (const char *name); extern char *cp_func_name (const char *full_name); +extern char *cp_remove_params (const char *demangled_name); + extern struct symbol **make_symbol_overload_list (const char *, const char *); diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 000616597e0..d0676ed3d5b 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -4375,7 +4375,7 @@ process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu) * sizeof (struct field)); } - FIELD_NAME (fields[num_fields]) = DEPRECATED_SYMBOL_NAME (sym); + FIELD_NAME (fields[num_fields]) = SYMBOL_LINKAGE_NAME (sym); FIELD_TYPE (fields[num_fields]) = NULL; FIELD_BITPOS (fields[num_fields]) = SYMBOL_VALUE (sym); FIELD_BITSIZE (fields[num_fields]) = 0; @@ -7624,7 +7624,7 @@ dwarf2_const_value (struct attribute *attr, struct symbol *sym, { case DW_FORM_addr: if (TYPE_LENGTH (SYMBOL_TYPE (sym)) != cu_header->addr_size) - dwarf2_const_value_length_mismatch_complaint (DEPRECATED_SYMBOL_NAME (sym), + dwarf2_const_value_length_mismatch_complaint (SYMBOL_PRINT_NAME (sym), cu_header->addr_size, TYPE_LENGTH (SYMBOL_TYPE (sym))); @@ -7648,7 +7648,7 @@ dwarf2_const_value (struct attribute *attr, struct symbol *sym, case DW_FORM_block: blk = DW_BLOCK (attr); if (TYPE_LENGTH (SYMBOL_TYPE (sym)) != blk->size) - dwarf2_const_value_length_mismatch_complaint (DEPRECATED_SYMBOL_NAME (sym), + dwarf2_const_value_length_mismatch_complaint (SYMBOL_PRINT_NAME (sym), blk->size, TYPE_LENGTH (SYMBOL_TYPE (sym))); diff --git a/gdb/expprint.c b/gdb/expprint.c index 880c953f98f..fb95944fc00 100644 --- a/gdb/expprint.c +++ b/gdb/expprint.c @@ -954,7 +954,7 @@ dump_subexp_body_standard (struct expression *exp, fprintf_filtered (stream, ", symbol @"); gdb_print_host_address (exp->elts[elt + 1].symbol, stream); fprintf_filtered (stream, " (%s)", - DEPRECATED_SYMBOL_NAME (exp->elts[elt + 1].symbol)); + SYMBOL_PRINT_NAME (exp->elts[elt + 1].symbol)); elt += 3; break; case OP_LAST: diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c index 2c482fa83a2..4cbb7888a5a 100644 --- a/gdb/f-valprint.c +++ b/gdb/f-valprint.c @@ -677,9 +677,9 @@ info_common_command (char *comname, int from_tty) if (msymbol != NULL && (SYMBOL_VALUE_ADDRESS (msymbol) > BLOCK_START (SYMBOL_BLOCK_VALUE (func)))) - funname = DEPRECATED_SYMBOL_NAME (msymbol); + funname = SYMBOL_LINKAGE_NAME (msymbol); else - funname = DEPRECATED_SYMBOL_NAME (func); + funname = SYMBOL_LINKAGE_NAME (func); } else { @@ -687,7 +687,7 @@ info_common_command (char *comname, int from_tty) lookup_minimal_symbol_by_pc (get_frame_pc (fi)); if (msymbol != NULL) - funname = DEPRECATED_SYMBOL_NAME (msymbol); + funname = SYMBOL_LINKAGE_NAME (msymbol); else /* Got no 'funname', code below will fail. */ error (_("No function found for frame.")); } @@ -715,7 +715,7 @@ info_common_command (char *comname, int from_tty) while (entry != NULL) { - printf_filtered ("%s = ", DEPRECATED_SYMBOL_NAME (entry->symbol)); + printf_filtered ("%s = ", SYMBOL_PRINT_NAME (entry->symbol)); print_variable_value (entry->symbol, fi, gdb_stdout); printf_filtered ("\n"); entry = entry->next; @@ -768,9 +768,9 @@ there_is_a_visible_common_named (char *comname) if (msymbol != NULL && (SYMBOL_VALUE_ADDRESS (msymbol) > BLOCK_START (SYMBOL_BLOCK_VALUE (func)))) - funname = DEPRECATED_SYMBOL_NAME (msymbol); + funname = SYMBOL_LINKAGE_NAME (msymbol); else - funname = DEPRECATED_SYMBOL_NAME (func); + funname = SYMBOL_LINKAGE_NAME (func); } else { @@ -778,7 +778,7 @@ there_is_a_visible_common_named (char *comname) lookup_minimal_symbol_by_pc (fi->pc); if (msymbol != NULL) - funname = DEPRECATED_SYMBOL_NAME (msymbol); + funname = SYMBOL_LINKAGE_NAME (msymbol); } the_common = find_common_for_function (comname, funname); diff --git a/gdb/findvar.c b/gdb/findvar.c index 1b11e59d0bc..e67a66623a3 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -537,7 +537,7 @@ read_var_value (struct symbol *var, struct frame_info *frame) { struct minimal_symbol *msym; - msym = lookup_minimal_symbol (DEPRECATED_SYMBOL_NAME (var), NULL, NULL); + msym = lookup_minimal_symbol (SYMBOL_LINKAGE_NAME (var), NULL, NULL); if (msym == NULL) return 0; if (overlay_debugging) diff --git a/gdb/gnu-v2-abi.c b/gdb/gnu-v2-abi.c index 9cc34e60b12..76d5f133e87 100644 --- a/gdb/gnu-v2-abi.c +++ b/gdb/gnu-v2-abi.c @@ -250,7 +250,7 @@ gnuv2_value_rtti_type (struct value *v, int *full, int *top, int *using_enc) /* Try to find a symbol that is the vtable */ minsym=lookup_minimal_symbol_by_pc(vtbl); if (minsym==NULL - || (demangled_name=DEPRECATED_SYMBOL_NAME (minsym))==NULL + || (demangled_name=SYMBOL_LINKAGE_NAME (minsym))==NULL || !is_vtable_name (demangled_name)) return NULL; diff --git a/gdb/hppa-hpux-tdep.c b/gdb/hppa-hpux-tdep.c index 1e5d1fbeb31..15539688c71 100644 --- a/gdb/hppa-hpux-tdep.c +++ b/gdb/hppa-hpux-tdep.c @@ -97,7 +97,7 @@ hppa32_hpux_in_solib_call_trampoline (CORE_ADDR pc, char *name) return 1; minsym = lookup_minimal_symbol_by_pc (pc); - if (minsym && strcmp (DEPRECATED_SYMBOL_NAME (minsym), ".stub") == 0) + if (minsym && strcmp (SYMBOL_LINKAGE_NAME (minsym), ".stub") == 0) return 1; /* Get the unwind descriptor corresponding to PC, return zero @@ -376,8 +376,8 @@ hppa_hpux_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc) ALL_MSYMBOLS (objfile, msymbol) { if (MSYMBOL_TYPE (msymbol) == mst_text - && strcmp (DEPRECATED_SYMBOL_NAME (msymbol), - DEPRECATED_SYMBOL_NAME (msym)) == 0) + && strcmp (SYMBOL_LINKAGE_NAME (msymbol), + SYMBOL_LINKAGE_NAME (msym)) == 0) { function_found = 1; break; @@ -472,11 +472,11 @@ hppa_hpux_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc) return orig_pc == pc ? 0 : pc & ~0x3; } - libsym = lookup_minimal_symbol (DEPRECATED_SYMBOL_NAME (stubsym), NULL, NULL); + libsym = lookup_minimal_symbol (SYMBOL_LINKAGE_NAME (stubsym), NULL, NULL); if (libsym == NULL) { warning (_("Unable to find library symbol for %s."), - DEPRECATED_SYMBOL_NAME (stubsym)); + SYMBOL_PRINT_NAME (stubsym)); return orig_pc == pc ? 0 : pc & ~0x3; } diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c index 6080839e41a..8a5a8f9c066 100644 --- a/gdb/jv-lang.c +++ b/gdb/jv-lang.c @@ -145,7 +145,7 @@ add_class_symbol (struct type *type, CORE_ADDR addr) obstack_alloc (&dynamics_objfile->objfile_obstack, sizeof (struct symbol)); memset (sym, 0, sizeof (struct symbol)); SYMBOL_LANGUAGE (sym) = language_java; - DEPRECATED_SYMBOL_NAME (sym) = TYPE_TAG_NAME (type); + SYMBOL_SET_LINKAGE_NAME (sym, TYPE_TAG_NAME (type)); SYMBOL_CLASS (sym) = LOC_TYPEDEF; /* SYMBOL_VALUE (sym) = valu; */ SYMBOL_TYPE (sym) = type; diff --git a/gdb/linespec.c b/gdb/linespec.c index f83936c5223..d00149da5c0 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -586,7 +586,7 @@ See set/show multiple-symbol.")); { if (canonical_arr[i] == NULL) { - symname = DEPRECATED_SYMBOL_NAME (sym_arr[i]); + symname = SYMBOL_LINKAGE_NAME (sym_arr[i]); canonical_arr[i] = savestring (symname, strlen (symname)); } } @@ -609,7 +609,7 @@ See set/show multiple-symbol.")); { if (canonical_arr) { - symname = DEPRECATED_SYMBOL_NAME (sym_arr[num]); + symname = SYMBOL_LINKAGE_NAME (sym_arr[num]); make_cleanup (xfree, symname); canonical_arr[i] = savestring (symname, strlen (symname)); } diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index 4f9841982b7..ab797f5586c 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -626,7 +626,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, /* It is a FORTRAN common block. At least for SGI Fortran the address is not in the symbol; we need to fix it later in scan_file_globals. */ - int bucket = hashname (DEPRECATED_SYMBOL_NAME (s)); + int bucket = hashname (SYMBOL_LINKAGE_NAME (s)); SYMBOL_VALUE_CHAIN (s) = global_sym_chain[bucket]; global_sym_chain[bucket] = s; } @@ -1064,9 +1064,9 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, obstack_alloc (¤t_objfile->objfile_obstack, sizeof (struct symbol))); memset (enum_sym, 0, sizeof (struct symbol)); - DEPRECATED_SYMBOL_NAME (enum_sym) = - obsavestring (f->name, strlen (f->name), - ¤t_objfile->objfile_obstack); + SYMBOL_SET_LINKAGE_NAME + (enum_sym, obsavestring (f->name, strlen (f->name), + ¤t_objfile->objfile_obstack)); SYMBOL_CLASS (enum_sym) = LOC_CONST; SYMBOL_TYPE (enum_sym) = t; SYMBOL_DOMAIN (enum_sym) = VAR_DOMAIN; @@ -1328,7 +1328,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, for anything except pointers or functions. */ } else - TYPE_NAME (SYMBOL_TYPE (s)) = DEPRECATED_SYMBOL_NAME (s); + TYPE_NAME (SYMBOL_TYPE (s)) = SYMBOL_LINKAGE_NAME (s); } break; @@ -4417,10 +4417,10 @@ mylookup_symbol (char *name, struct block *block, inc = name[0]; ALL_BLOCK_SYMBOLS (block, iter, sym) { - if (DEPRECATED_SYMBOL_NAME (sym)[0] == inc + if (SYMBOL_LINKAGE_NAME (sym)[0] == inc && SYMBOL_DOMAIN (sym) == domain && SYMBOL_CLASS (sym) == class - && strcmp (DEPRECATED_SYMBOL_NAME (sym), name) == 0) + && strcmp (SYMBOL_LINKAGE_NAME (sym), name) == 0) return sym; } diff --git a/gdb/minsyms.c b/gdb/minsyms.c index 59febf295e9..34bbbb9c9ad 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -126,7 +126,8 @@ add_minsym_to_demangled_hash_table (struct minimal_symbol *sym, { if (sym->demangled_hash_next == NULL) { - unsigned int hash = msymbol_hash_iw (SYMBOL_DEMANGLED_NAME (sym)) % MINIMAL_SYMBOL_HASH_SIZE; + unsigned int hash + = msymbol_hash_iw (SYMBOL_SEARCH_NAME (sym)) % MINIMAL_SYMBOL_HASH_SIZE; sym->demangled_hash_next = table[hash]; table[hash] = sym; } @@ -214,15 +215,13 @@ lookup_minimal_symbol (const char *name, const char *sfile, while (msymbol != NULL && found_symbol == NULL) { - /* FIXME: carlton/2003-02-27: This is an unholy - mixture of linkage names and natural names. If - you want to test the linkage names with strcmp, - do that. If you want to test the natural names - with strcmp_iw, use SYMBOL_MATCHES_NATURAL_NAME. */ - if (strcmp (DEPRECATED_SYMBOL_NAME (msymbol), (name)) == 0 - || (SYMBOL_DEMANGLED_NAME (msymbol) != NULL - && strcmp_iw (SYMBOL_DEMANGLED_NAME (msymbol), - (name)) == 0)) + int match; + + if (pass == 1) + match = strcmp (SYMBOL_LINKAGE_NAME (msymbol), name) == 0; + else + match = SYMBOL_MATCHES_SEARCH_NAME (msymbol, name); + if (match) { switch (MSYMBOL_TYPE (msymbol)) { diff --git a/gdb/objfiles.h b/gdb/objfiles.h index 16fcb8d1256..d98eabbc4a5 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -540,7 +540,7 @@ extern void *objfile_data (struct objfile *objfile, /* Traverse all minimal symbols in one objfile. */ #define ALL_OBJFILE_MSYMBOLS(objfile, m) \ - for ((m) = (objfile) -> msymbols; DEPRECATED_SYMBOL_NAME(m) != NULL; (m)++) + for ((m) = (objfile) -> msymbols; SYMBOL_LINKAGE_NAME(m) != NULL; (m)++) /* Traverse all symtabs in all objfiles. */ diff --git a/gdb/printcmd.c b/gdb/printcmd.c index cb280e0774a..96fc6dbbb5f 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -626,7 +626,7 @@ build_address_symbolic (CORE_ADDR addr, /* IN */ if (do_demangle || asm_demangle) name_temp = SYMBOL_PRINT_NAME (symbol); else - name_temp = DEPRECATED_SYMBOL_NAME (symbol); + name_temp = SYMBOL_LINKAGE_NAME (symbol); } if (msymbol != NULL) @@ -640,7 +640,7 @@ build_address_symbolic (CORE_ADDR addr, /* IN */ if (do_demangle || asm_demangle) name_temp = SYMBOL_PRINT_NAME (msymbol); else - name_temp = DEPRECATED_SYMBOL_NAME (msymbol); + name_temp = SYMBOL_LINKAGE_NAME (msymbol); } } if (symbol == NULL && msymbol == NULL) @@ -1079,7 +1079,7 @@ address_info (char *exp, int from_tty) } printf_filtered ("Symbol \""); - fprintf_symbol_filtered (gdb_stdout, DEPRECATED_SYMBOL_NAME (sym), + fprintf_symbol_filtered (gdb_stdout, SYMBOL_PRINT_NAME (sym), current_language->la_language, DMGL_ANSI); printf_filtered ("\" is "); val = SYMBOL_VALUE (sym); @@ -1174,7 +1174,7 @@ address_info (char *exp, int from_tty) { struct minimal_symbol *msym; - msym = lookup_minimal_symbol (DEPRECATED_SYMBOL_NAME (sym), NULL, NULL); + msym = lookup_minimal_symbol (SYMBOL_LINKAGE_NAME (sym), NULL, NULL); if (msym == NULL) printf_filtered ("unresolved"); else diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c index ab7ec5d2244..51a39262397 100644 --- a/gdb/sol-thread.c +++ b/gdb/sol-thread.c @@ -1469,7 +1469,7 @@ info_cb (const td_thrhandle_t *th, void *s) msym = lookup_minimal_symbol_by_pc (ti.ti_startfunc); if (msym) printf_filtered (" startfunc: %s\n", - DEPRECATED_SYMBOL_NAME (msym)); + SYMBOL_PRINT_NAME (msym)); else printf_filtered (" startfunc: 0x%s\n", paddr (ti.ti_startfunc)); } @@ -1481,7 +1481,7 @@ info_cb (const td_thrhandle_t *th, void *s) msym = lookup_minimal_symbol_by_pc (ti.ti_pc); if (msym) printf_filtered (" - Sleep func: %s\n", - DEPRECATED_SYMBOL_NAME (msym)); + SYMBOL_PRINT_NAME (msym)); else printf_filtered (" - Sleep func: 0x%s\n", paddr (ti.ti_startfunc)); } diff --git a/gdb/stabsread.c b/gdb/stabsread.c index e9580f948d7..110f9373b34 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -387,8 +387,9 @@ patch_block_stabs (struct pending *symbols, struct pending_stabs *stabs, memset (sym, 0, sizeof (struct symbol)); SYMBOL_DOMAIN (sym) = VAR_DOMAIN; SYMBOL_CLASS (sym) = LOC_OPTIMIZED_OUT; - DEPRECATED_SYMBOL_NAME (sym) = - obsavestring (name, pp - name, &objfile->objfile_obstack); + SYMBOL_SET_LINKAGE_NAME + (sym, obsavestring (name, pp - name, + &objfile->objfile_obstack)); pp += 2; if (*(pp - 1) == 'F' || *(pp - 1) == 'f') { @@ -648,17 +649,18 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, switch (string[1]) { case 't': - DEPRECATED_SYMBOL_NAME (sym) = obsavestring ("this", strlen ("this"), - &objfile->objfile_obstack); + SYMBOL_SET_LINKAGE_NAME + (sym, obsavestring ("this", strlen ("this"), + &objfile->objfile_obstack)); break; case 'v': /* $vtbl_ptr_type */ - /* Was: DEPRECATED_SYMBOL_NAME (sym) = "vptr"; */ goto normal; case 'e': - DEPRECATED_SYMBOL_NAME (sym) = obsavestring ("eh_throw", strlen ("eh_throw"), - &objfile->objfile_obstack); + SYMBOL_SET_LINKAGE_NAME + (sym, obsavestring ("eh_throw", strlen ("eh_throw"), + &objfile->objfile_obstack)); break; case '_': @@ -892,9 +894,9 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, Symbol references don't have valid names and wont't match up with minimal symbols when the global_sym_chain is relocated. We'll fixup symbol references when we fixup the defining symbol. */ - if (DEPRECATED_SYMBOL_NAME (sym) && DEPRECATED_SYMBOL_NAME (sym)[0] != '#') + if (SYMBOL_LINKAGE_NAME (sym) && SYMBOL_LINKAGE_NAME (sym)[0] != '#') { - i = hashname (DEPRECATED_SYMBOL_NAME (sym)); + i = hashname (SYMBOL_LINKAGE_NAME (sym)); SYMBOL_VALUE_CHAIN (sym) = global_sym_chain[i]; global_sym_chain[i] = sym; } @@ -1038,8 +1040,8 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, prev_sym = local_symbols->symbol[local_symbols->nsyms - 1]; if ((SYMBOL_CLASS (prev_sym) == LOC_REF_ARG || SYMBOL_CLASS (prev_sym) == LOC_ARG) - && strcmp (DEPRECATED_SYMBOL_NAME (prev_sym), - DEPRECATED_SYMBOL_NAME (sym)) == 0) + && strcmp (SYMBOL_LINKAGE_NAME (prev_sym), + SYMBOL_LINKAGE_NAME (sym)) == 0) { SYMBOL_CLASS (prev_sym) = LOC_REGISTER; /* Use the type from the LOC_REGISTER; that is the type @@ -1063,16 +1065,16 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, SYMBOL_VALUE_ADDRESS (sym) = valu; if (gdbarch_static_transform_name_p (gdbarch) && gdbarch_static_transform_name (gdbarch, - DEPRECATED_SYMBOL_NAME (sym)) - != DEPRECATED_SYMBOL_NAME (sym)) + SYMBOL_LINKAGE_NAME (sym)) + != SYMBOL_LINKAGE_NAME (sym)) { struct minimal_symbol *msym; - msym = lookup_minimal_symbol (DEPRECATED_SYMBOL_NAME (sym), NULL, objfile); + msym = lookup_minimal_symbol (SYMBOL_LINKAGE_NAME (sym), NULL, objfile); if (msym != NULL) { - DEPRECATED_SYMBOL_NAME (sym) = gdbarch_static_transform_name - (gdbarch, - DEPRECATED_SYMBOL_NAME (sym)); + char *new_name = gdbarch_static_transform_name + (gdbarch, SYMBOL_LINKAGE_NAME (sym)); + SYMBOL_SET_LINKAGE_NAME (sym, new_name); SYMBOL_VALUE_ADDRESS (sym) = SYMBOL_VALUE_ADDRESS (msym); } } @@ -1132,7 +1134,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, extern const char vtbl_ptr_name[]; if ((TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_PTR - && strcmp (DEPRECATED_SYMBOL_NAME (sym), vtbl_ptr_name)) + && strcmp (SYMBOL_LINKAGE_NAME (sym), vtbl_ptr_name)) || TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_FUNC) { /* If we are giving a name to a type such as "pointer to @@ -1172,11 +1174,11 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, /* Pascal accepts names for pointer types. */ if (current_subfile->language == language_pascal) { - TYPE_NAME (SYMBOL_TYPE (sym)) = DEPRECATED_SYMBOL_NAME (sym); + TYPE_NAME (SYMBOL_TYPE (sym)) = SYMBOL_LINKAGE_NAME (sym); } } else - TYPE_NAME (SYMBOL_TYPE (sym)) = DEPRECATED_SYMBOL_NAME (sym); + TYPE_NAME (SYMBOL_TYPE (sym)) = SYMBOL_LINKAGE_NAME (sym); } add_symbol_to_list (sym, &file_symbols); @@ -1194,7 +1196,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0) TYPE_NAME (SYMBOL_TYPE (sym)) = obconcat (&objfile->objfile_obstack, "", "", - DEPRECATED_SYMBOL_NAME (sym)); + SYMBOL_LINKAGE_NAME (sym)); add_symbol_to_list (struct_sym, &file_symbols); } @@ -1220,7 +1222,8 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, SYMBOL_DOMAIN (sym) = STRUCT_DOMAIN; if (TYPE_TAG_NAME (SYMBOL_TYPE (sym)) == 0) TYPE_TAG_NAME (SYMBOL_TYPE (sym)) - = obconcat (&objfile->objfile_obstack, "", "", DEPRECATED_SYMBOL_NAME (sym)); + = obconcat (&objfile->objfile_obstack, "", "", + SYMBOL_LINKAGE_NAME (sym)); add_symbol_to_list (sym, &file_symbols); if (synonym) @@ -1234,7 +1237,8 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, SYMBOL_DOMAIN (typedef_sym) = VAR_DOMAIN; if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0) TYPE_NAME (SYMBOL_TYPE (sym)) - = obconcat (&objfile->objfile_obstack, "", "", DEPRECATED_SYMBOL_NAME (sym)); + = obconcat (&objfile->objfile_obstack, "", "", + SYMBOL_LINKAGE_NAME (sym)); add_symbol_to_list (typedef_sym, &file_symbols); } break; @@ -1246,16 +1250,16 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, SYMBOL_VALUE_ADDRESS (sym) = valu; if (gdbarch_static_transform_name_p (gdbarch) && gdbarch_static_transform_name (gdbarch, - DEPRECATED_SYMBOL_NAME (sym)) - != DEPRECATED_SYMBOL_NAME (sym)) + SYMBOL_LINKAGE_NAME (sym)) + != SYMBOL_LINKAGE_NAME (sym)) { struct minimal_symbol *msym; - msym = lookup_minimal_symbol (DEPRECATED_SYMBOL_NAME (sym), NULL, objfile); + msym = lookup_minimal_symbol (SYMBOL_LINKAGE_NAME (sym), NULL, objfile); if (msym != NULL) { - DEPRECATED_SYMBOL_NAME (sym) = gdbarch_static_transform_name - (gdbarch, - DEPRECATED_SYMBOL_NAME (sym)); + char *new_name = gdbarch_static_transform_name + (gdbarch, SYMBOL_LINKAGE_NAME (sym)); + SYMBOL_SET_LINKAGE_NAME (sym, new_name); SYMBOL_VALUE_ADDRESS (sym) = SYMBOL_VALUE_ADDRESS (msym); } } @@ -1539,7 +1543,7 @@ again: if (SYMBOL_CLASS (sym) == LOC_TYPEDEF && SYMBOL_DOMAIN (sym) == STRUCT_DOMAIN && (TYPE_CODE (SYMBOL_TYPE (sym)) == code) - && strcmp (DEPRECATED_SYMBOL_NAME (sym), type_name) == 0) + && strcmp (SYMBOL_LINKAGE_NAME (sym), type_name) == 0) { obstack_free (&objfile->objfile_obstack, type_name); type = SYMBOL_TYPE (sym); @@ -3488,7 +3492,7 @@ read_enum_type (char **pp, struct type *type, sym = (struct symbol *) obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol)); memset (sym, 0, sizeof (struct symbol)); - DEPRECATED_SYMBOL_NAME (sym) = name; + SYMBOL_SET_LINKAGE_NAME (sym, name); SYMBOL_LANGUAGE (sym) = current_subfile->language; SYMBOL_CLASS (sym) = LOC_CONST; SYMBOL_DOMAIN (sym) = VAR_DOMAIN; @@ -3530,7 +3534,7 @@ read_enum_type (char **pp, struct type *type, { struct symbol *xsym = syms->symbol[j]; SYMBOL_TYPE (xsym) = type; - TYPE_FIELD_NAME (type, n) = DEPRECATED_SYMBOL_NAME (xsym); + TYPE_FIELD_NAME (type, n) = SYMBOL_LINKAGE_NAME (xsym); TYPE_FIELD_BITPOS (type, n) = SYMBOL_VALUE (xsym); TYPE_FIELD_BITSIZE (type, n) = 0; } @@ -4145,7 +4149,7 @@ common_block_end (struct objfile *objfile) obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol)); memset (sym, 0, sizeof (struct symbol)); /* Note: common_block_name already saved on objfile_obstack */ - DEPRECATED_SYMBOL_NAME (sym) = common_block_name; + SYMBOL_SET_LINKAGE_NAME (sym, common_block_name); SYMBOL_CLASS (sym) = LOC_BLOCK; /* Now we copy all the symbols which have been defined since the BCOMM. */ @@ -4172,7 +4176,7 @@ common_block_end (struct objfile *objfile) /* Should we be putting local_symbols back to what it was? Does it matter? */ - i = hashname (DEPRECATED_SYMBOL_NAME (sym)); + i = hashname (SYMBOL_LINKAGE_NAME (sym)); SYMBOL_VALUE_CHAIN (sym) = global_sym_chain[i]; global_sym_chain[i] = sym; common_block_name = NULL; @@ -4354,7 +4358,7 @@ cleanup_undefined_types_1 (void) TYPE_CODE (*type)) && (TYPE_INSTANCE_FLAGS (*type) == TYPE_INSTANCE_FLAGS (SYMBOL_TYPE (sym))) - && strcmp (DEPRECATED_SYMBOL_NAME (sym), + && strcmp (SYMBOL_LINKAGE_NAME (sym), typename) == 0) replace_type (*type, SYMBOL_TYPE (sym)); } @@ -4421,9 +4425,7 @@ scan_file_globals (struct objfile *objfile) if (hash >= HASHSIZE) return; - for (msymbol = resolve_objfile->msymbols; - msymbol && DEPRECATED_SYMBOL_NAME (msymbol) != NULL; - msymbol++) + ALL_OBJFILE_MSYMBOLS (resolve_objfile, msymbol) { QUIT; @@ -4443,12 +4445,12 @@ scan_file_globals (struct objfile *objfile) /* Get the hash index and check all the symbols under that hash index. */ - hash = hashname (DEPRECATED_SYMBOL_NAME (msymbol)); + hash = hashname (SYMBOL_LINKAGE_NAME (msymbol)); for (sym = global_sym_chain[hash]; sym;) { - if (DEPRECATED_SYMBOL_NAME (msymbol)[0] == DEPRECATED_SYMBOL_NAME (sym)[0] && - strcmp (DEPRECATED_SYMBOL_NAME (msymbol) + 1, DEPRECATED_SYMBOL_NAME (sym) + 1) == 0) + if (strcmp (SYMBOL_LINKAGE_NAME (msymbol), + SYMBOL_LINKAGE_NAME (sym)) == 0) { /* Splice this symbol out of the hash chain and assign the value we have to it. */ @@ -4520,7 +4522,7 @@ scan_file_globals (struct objfile *objfile) else complaint (&symfile_complaints, _("%s: common block `%s' from global_sym_chain unresolved"), - objfile->name, DEPRECATED_SYMBOL_NAME (prev)); + objfile->name, SYMBOL_PRINT_NAME (prev)); } } memset (global_sym_chain, 0, sizeof (global_sym_chain)); diff --git a/gdb/stack.c b/gdb/stack.c index ca39d48a289..d9c4f0a239a 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -44,6 +44,7 @@ #include "solib.h" #include "valprint.h" #include "gdbthread.h" +#include "cp-support.h" #include "gdb_assert.h" #include <ctype.h> @@ -287,10 +288,10 @@ print_frame_args (struct symbol *func, struct frame_info *frame, parameter names occur on the RS/6000, for traceback tables. FIXME, should we even print them? */ - if (*DEPRECATED_SYMBOL_NAME (sym)) + if (*SYMBOL_LINKAGE_NAME (sym)) { struct symbol *nsym; - nsym = lookup_symbol (DEPRECATED_SYMBOL_NAME (sym), + nsym = lookup_symbol (SYMBOL_LINKAGE_NAME (sym), b, VAR_DOMAIN, NULL); gdb_assert (nsym != NULL); if (SYMBOL_CLASS (nsym) == LOC_REGISTER @@ -618,12 +619,12 @@ print_frame (struct frame_info *frame, int print_level, /* We also don't know anything about the function besides its address and name. */ func = 0; - funname = DEPRECATED_SYMBOL_NAME (msymbol); + funname = SYMBOL_PRINT_NAME (msymbol); funlang = SYMBOL_LANGUAGE (msymbol); } else { - funname = DEPRECATED_SYMBOL_NAME (func); + funname = SYMBOL_PRINT_NAME (func); funlang = SYMBOL_LANGUAGE (func); if (funlang == language_cplus) { @@ -631,23 +632,13 @@ print_frame (struct frame_info *frame, int print_level, to display the demangled name that we already have stored in the symbol table, but we stored a version with DMGL_PARAMS turned on, and here we don't want to - display parameters. So call the demangler again, with - DMGL_ANSI only. - - Yes, printf_symbol_filtered() will again try to - demangle the name on the fly, but the issue is that - if cplus_demangle() fails here, it will fail there - too. So we want to catch the failure (where DEMANGLED - is NULL below) here, while we still have our hands on - the function symbol.) */ - char *demangled = cplus_demangle (funname, DMGL_ANSI); - if (demangled == NULL) - /* If the demangler fails, try the demangled name from - the symbol table. That'll have parameters, but - that's preferable to displaying a mangled name. */ - funname = SYMBOL_PRINT_NAME (func); - else - xfree (demangled); + display parameters. So remove the parameters. */ + char *func_only = cp_remove_params (funname); + if (func_only) + { + funname = func_only; + make_cleanup (xfree, func_only); + } } } } @@ -658,7 +649,7 @@ print_frame (struct frame_info *frame, int print_level, if (msymbol != NULL) { - funname = DEPRECATED_SYMBOL_NAME (msymbol); + funname = SYMBOL_PRINT_NAME (msymbol); funlang = SYMBOL_LANGUAGE (msymbol); } } @@ -895,6 +886,7 @@ frame_info (char *addr_exp, int from_tty) const char *pc_regname; int selected_frame_p; struct gdbarch *gdbarch; + struct cleanup *back_to = make_cleanup (null_cleanup, NULL); fi = parse_frame_specification_1 (addr_exp, "No stack.", &selected_frame_p); gdbarch = get_frame_arch (fi); @@ -920,29 +912,21 @@ frame_info (char *addr_exp, int from_tty) s = find_pc_symtab (get_frame_pc (fi)); if (func) { - /* It seems appropriate to use SYMBOL_PRINT_NAME() here, to - display the demangled name that we already have stored in the - symbol table, but we stored a version with DMGL_PARAMS turned - on, and here we don't want to display parameters. So call the - demangler again, with DMGL_ANSI only. - - Yes, printf_symbol_filtered() will again try to demangle the - name on the fly, but the issue is that if cplus_demangle() - fails here, it will fail there too. So we want to catch the - failure (where DEMANGLED is NULL below) here, while we still - have our hands on the function symbol.) */ - funname = DEPRECATED_SYMBOL_NAME (func); + funname = SYMBOL_PRINT_NAME (func); funlang = SYMBOL_LANGUAGE (func); if (funlang == language_cplus) { - char *demangled = cplus_demangle (funname, DMGL_ANSI); - /* If the demangler fails, try the demangled name from the - symbol table. That'll have parameters, but that's - preferable to displaying a mangled name. */ - if (demangled == NULL) - funname = SYMBOL_PRINT_NAME (func); - else - xfree (demangled); + /* It seems appropriate to use SYMBOL_PRINT_NAME() here, + to display the demangled name that we already have + stored in the symbol table, but we stored a version + with DMGL_PARAMS turned on, and here we don't want to + display parameters. So remove the parameters. */ + char *func_only = cp_remove_params (funname); + if (func_only) + { + funname = func_only; + make_cleanup (xfree, func_only); + } } } else @@ -952,7 +936,7 @@ frame_info (char *addr_exp, int from_tty) msymbol = lookup_minimal_symbol_by_pc (get_frame_pc (fi)); if (msymbol != NULL) { - funname = DEPRECATED_SYMBOL_NAME (msymbol); + funname = SYMBOL_PRINT_NAME (msymbol); funlang = SYMBOL_LANGUAGE (msymbol); } } @@ -1154,6 +1138,8 @@ frame_info (char *addr_exp, int from_tty) if (count || need_nl) puts_filtered ("\n"); } + + do_cleanups (back_to); } /* Print briefly all stack frames or just the innermost COUNT_EXP @@ -1410,7 +1396,7 @@ print_block_frame_labels (struct block *b, int *have_default, ALL_BLOCK_SYMBOLS (b, iter, sym) { - if (strcmp (DEPRECATED_SYMBOL_NAME (sym), "default") == 0) + if (strcmp (SYMBOL_LINKAGE_NAME (sym), "default") == 0) { if (*have_default) continue; @@ -1594,7 +1580,7 @@ print_frame_arg_vars (struct frame_info *frame, struct ui_file *stream) float). There are also LOC_ARG/LOC_REGISTER pairs which are not combined in symbol-reading. */ - sym2 = lookup_symbol (DEPRECATED_SYMBOL_NAME (sym), + sym2 = lookup_symbol (SYMBOL_LINKAGE_NAME (sym), b, VAR_DOMAIN, NULL); print_variable_value (sym2, frame, stream); fprintf_filtered (stream, "\n"); diff --git a/gdb/symmisc.c b/gdb/symmisc.c index 7365bab588d..568cc683527 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -270,8 +270,8 @@ dump_msymbols (struct objfile *objfile, struct ui_file *outfile) fprintf_filtered (outfile, "No minimal symbols found.\n"); return; } - for (index = 0, msymbol = objfile->msymbols; - DEPRECATED_SYMBOL_NAME (msymbol) != NULL; msymbol++, index++) + index = 0; + ALL_OBJFILE_MSYMBOLS (objfile, msymbol) { switch (msymbol->type) { @@ -308,7 +308,7 @@ dump_msymbols (struct objfile *objfile, struct ui_file *outfile) } fprintf_filtered (outfile, "[%2d] %c ", index, ms_type); fputs_filtered (paddress (SYMBOL_VALUE_ADDRESS (msymbol)), outfile); - fprintf_filtered (outfile, " %s", DEPRECATED_SYMBOL_NAME (msymbol)); + fprintf_filtered (outfile, " %s", SYMBOL_LINKAGE_NAME (msymbol)); if (SYMBOL_BFD_SECTION (msymbol)) fprintf_filtered (outfile, " section %s", bfd_section_name (objfile->obfd, @@ -320,6 +320,7 @@ dump_msymbols (struct objfile *objfile, struct ui_file *outfile) if (msymbol->filename) fprintf_filtered (outfile, " %s", msymbol->filename); fputs_filtered ("\n", outfile); + index++; } if (objfile->minimal_symbol_count != index) { @@ -459,7 +460,8 @@ dump_symtab_1 (struct objfile *objfile, struct symtab *symtab, fputs_filtered (paddress (BLOCK_END (b)), outfile); if (BLOCK_FUNCTION (b)) { - fprintf_filtered (outfile, ", function %s", DEPRECATED_SYMBOL_NAME (BLOCK_FUNCTION (b))); + fprintf_filtered (outfile, ", function %s", + SYMBOL_LINKAGE_NAME (BLOCK_FUNCTION (b))); if (SYMBOL_DEMANGLED_NAME (BLOCK_FUNCTION (b)) != NULL) { fprintf_filtered (outfile, ", %s", @@ -591,7 +593,7 @@ print_symbol (void *args) ? "enum" : (TYPE_CODE (SYMBOL_TYPE (symbol)) == TYPE_CODE_STRUCT ? "struct" : "union")), - DEPRECATED_SYMBOL_NAME (symbol)); + SYMBOL_LINKAGE_NAME (symbol)); LA_PRINT_TYPE (SYMBOL_TYPE (symbol), "", outfile, 1, depth); } fprintf_filtered (outfile, ";\n"); @@ -775,7 +777,7 @@ print_partial_symbols (struct partial_symbol **p, int count, char *what, fprintf_filtered (outfile, " %s partial symbols:\n", what); while (count-- > 0) { - fprintf_filtered (outfile, " `%s'", DEPRECATED_SYMBOL_NAME (*p)); + fprintf_filtered (outfile, " `%s'", SYMBOL_LINKAGE_NAME (*p)); if (SYMBOL_DEMANGLED_NAME (*p) != NULL) { fprintf_filtered (outfile, " `%s'", SYMBOL_DEMANGLED_NAME (*p)); @@ -1091,12 +1093,12 @@ maintenance_check_symtabs (char *ignore, int from_tty) length = ps->n_static_syms; while (length--) { - sym = lookup_block_symbol (b, DEPRECATED_SYMBOL_NAME (*psym), + sym = lookup_block_symbol (b, SYMBOL_LINKAGE_NAME (*psym), NULL, SYMBOL_DOMAIN (*psym)); if (!sym) { printf_filtered ("Static symbol `"); - puts_filtered (DEPRECATED_SYMBOL_NAME (*psym)); + puts_filtered (SYMBOL_LINKAGE_NAME (*psym)); printf_filtered ("' only found in "); puts_filtered (ps->filename); printf_filtered (" psymtab\n"); @@ -1108,12 +1110,12 @@ maintenance_check_symtabs (char *ignore, int from_tty) length = ps->n_global_syms; while (length--) { - sym = lookup_block_symbol (b, DEPRECATED_SYMBOL_NAME (*psym), + sym = lookup_block_symbol (b, SYMBOL_LINKAGE_NAME (*psym), NULL, SYMBOL_DOMAIN (*psym)); if (!sym) { printf_filtered ("Global symbol `"); - puts_filtered (DEPRECATED_SYMBOL_NAME (*psym)); + puts_filtered (SYMBOL_LINKAGE_NAME (*psym)); printf_filtered ("' only found in "); puts_filtered (ps->filename); printf_filtered (" psymtab\n"); diff --git a/gdb/symtab.h b/gdb/symtab.h index ae4faf5d225..43c4e812b90 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -162,7 +162,6 @@ extern CORE_ADDR symbol_overlayed_address (CORE_ADDR, asection *); functions, unless the callers are changed to pass in the ginfo field only, instead of the SYMBOL parameter. */ -#define DEPRECATED_SYMBOL_NAME(symbol) (symbol)->ginfo.name #define SYMBOL_VALUE(symbol) (symbol)->ginfo.value.ivalue #define SYMBOL_VALUE_ADDRESS(symbol) (symbol)->ginfo.value.address #define SYMBOL_VALUE_BYTES(symbol) (symbol)->ginfo.value.bytes @@ -182,6 +181,15 @@ extern CORE_ADDR symbol_overlayed_address (CORE_ADDR, asection *); extern void symbol_init_language_specific (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, + e.g. struct tags. Unlike SYMBOL_SET_NAMES, linkage_name must + be terminated and already on the objfile's obstack. */ +#define SYMBOL_SET_LINKAGE_NAME(symbol,linkage_name) \ + (symbol)->ginfo.name = (linkage_name) + +/* Set the linkage and natural names of a symbol, by demangling + the linkage name. */ #define SYMBOL_SET_NAMES(symbol,linkage_name,len,objfile) \ symbol_set_names (&(symbol)->ginfo, linkage_name, len, objfile) extern void symbol_set_names (struct general_symbol_info *symbol, @@ -194,10 +202,7 @@ extern void symbol_set_names (struct general_symbol_info *symbol, want to know what the linker thinks the symbol's name is. Use SYMBOL_PRINT_NAME for output. Use SYMBOL_DEMANGLED_NAME if you specifically need to know whether SYMBOL_NATURAL_NAME and - SYMBOL_LINKAGE_NAME are different. Don't use - DEPRECATED_SYMBOL_NAME at all: instances of that macro should be - replaced by SYMBOL_NATURAL_NAME, SYMBOL_LINKAGE_NAME, or perhaps - SYMBOL_PRINT_NAME. */ + SYMBOL_LINKAGE_NAME are different. */ /* Return SYMBOL's "natural" name, i.e. the name that it was called in the original source code. In languages like C++ where symbols may @@ -211,11 +216,7 @@ extern char *symbol_natural_name (const struct general_symbol_info *symbol); /* Return SYMBOL's name from the point of view of the linker. In languages like C++ where symbols may be mangled for ease of manipulation by the linker, this is the mangled name; otherwise, - it's the same as SYMBOL_NATURAL_NAME. This is currently identical - to DEPRECATED_SYMBOL_NAME, but please use SYMBOL_LINKAGE_NAME when - appropriate: it conveys the additional semantic information that - you really have thought about the issue and decided that you mean - SYMBOL_LINKAGE_NAME instead of SYMBOL_NATURAL_NAME. */ + it's the same as SYMBOL_NATURAL_NAME. */ #define SYMBOL_LINKAGE_NAME(symbol) (symbol)->ginfo.name diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 249e7ee5e68..e6d579e2f6b 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -285,12 +285,12 @@ set_traceframe_context (CORE_ADDR trace_pc) /* Save func name as "$trace_func", a debugger variable visible to users. */ if (traceframe_fun == NULL || - DEPRECATED_SYMBOL_NAME (traceframe_fun) == NULL) + SYMBOL_LINKAGE_NAME (traceframe_fun) == NULL) set_internalvar (lookup_internalvar ("trace_func"), value_from_pointer (charstar, (LONGEST) 0)); else { - len = strlen (DEPRECATED_SYMBOL_NAME (traceframe_fun)); + len = strlen (SYMBOL_LINKAGE_NAME (traceframe_fun)); func_range = create_range_type (func_range, builtin_type_int, 0, len - 1); func_string = create_array_type (func_string, @@ -298,7 +298,7 @@ set_traceframe_context (CORE_ADDR trace_pc) func_val = allocate_value (func_string); deprecated_set_value_type (func_val, func_string); memcpy (value_contents_raw (func_val), - DEPRECATED_SYMBOL_NAME (traceframe_fun), + SYMBOL_LINKAGE_NAME (traceframe_fun), len); deprecated_set_value_modifiable (func_val, 0); set_internalvar (lookup_internalvar ("trace_func"), func_val); @@ -981,14 +981,14 @@ validate_actionline (char **line, struct tracepoint *t) if (SYMBOL_CLASS (exp->elts[2].symbol) == LOC_CONST) { warning (_("constant %s (value %ld) will not be collected."), - DEPRECATED_SYMBOL_NAME (exp->elts[2].symbol), + SYMBOL_PRINT_NAME (exp->elts[2].symbol), SYMBOL_VALUE (exp->elts[2].symbol)); return BADLINE; } else if (SYMBOL_CLASS (exp->elts[2].symbol) == LOC_OPTIMIZED_OUT) { warning (_("%s is optimized away and cannot be collected."), - DEPRECATED_SYMBOL_NAME (exp->elts[2].symbol)); + SYMBOL_PRINT_NAME (exp->elts[2].symbol)); return BADLINE; } } @@ -1216,12 +1216,12 @@ collect_symbol (struct collection_list *collect, { default: printf_filtered ("%s: don't know symbol class %d\n", - DEPRECATED_SYMBOL_NAME (sym), + SYMBOL_PRINT_NAME (sym), SYMBOL_CLASS (sym)); break; case LOC_CONST: printf_filtered ("constant %s (value %ld) will not be collected.\n", - DEPRECATED_SYMBOL_NAME (sym), SYMBOL_VALUE (sym)); + SYMBOL_PRINT_NAME (sym), SYMBOL_VALUE (sym)); break; case LOC_STATIC: offset = SYMBOL_VALUE_ADDRESS (sym); @@ -1231,7 +1231,7 @@ collect_symbol (struct collection_list *collect, sprintf_vma (tmp, offset); printf_filtered ("LOC_STATIC %s: collect %ld bytes at %s.\n", - DEPRECATED_SYMBOL_NAME (sym), len, + SYMBOL_PRINT_NAME (sym), len, tmp /* address */); } add_memrange (collect, memrange_absolute, offset, len); @@ -1240,7 +1240,7 @@ collect_symbol (struct collection_list *collect, reg = SYMBOL_VALUE (sym); if (info_verbose) printf_filtered ("LOC_REG[parm] %s: ", - DEPRECATED_SYMBOL_NAME (sym)); + SYMBOL_PRINT_NAME (sym)); add_register (collect, reg); /* Check for doubles stored in two registers. */ /* FIXME: how about larger types stored in 3 or more regs? */ @@ -1251,7 +1251,7 @@ collect_symbol (struct collection_list *collect, case LOC_REF_ARG: printf_filtered ("Sorry, don't know how to do LOC_REF_ARG yet.\n"); printf_filtered (" (will not collect %s)\n", - DEPRECATED_SYMBOL_NAME (sym)); + SYMBOL_PRINT_NAME (sym)); break; case LOC_ARG: reg = frame_regno; @@ -1259,7 +1259,7 @@ collect_symbol (struct collection_list *collect, if (info_verbose) { printf_filtered ("LOC_LOCAL %s: Collect %ld bytes at offset ", - DEPRECATED_SYMBOL_NAME (sym), len); + SYMBOL_PRINT_NAME (sym), len); printf_vma (offset); printf_filtered (" from frame ptr reg %d\n", reg); } @@ -1271,7 +1271,7 @@ collect_symbol (struct collection_list *collect, if (info_verbose) { printf_filtered ("LOC_REGPARM_ADDR %s: Collect %ld bytes at offset ", - DEPRECATED_SYMBOL_NAME (sym), len); + SYMBOL_PRINT_NAME (sym), len); printf_vma (offset); printf_filtered (" from reg %d\n", reg); } @@ -1283,7 +1283,7 @@ collect_symbol (struct collection_list *collect, if (info_verbose) { printf_filtered ("LOC_LOCAL %s: Collect %ld bytes at offset ", - DEPRECATED_SYMBOL_NAME (sym), len); + SYMBOL_PRINT_NAME (sym), len); printf_vma (offset); printf_filtered (" from frame ptr reg %d\n", reg); } @@ -1291,11 +1291,11 @@ collect_symbol (struct collection_list *collect, break; case LOC_UNRESOLVED: printf_filtered ("Don't know LOC_UNRESOLVED %s\n", - DEPRECATED_SYMBOL_NAME (sym)); + SYMBOL_PRINT_NAME (sym)); break; case LOC_OPTIMIZED_OUT: printf_filtered ("%s has been optimized out of existence.\n", - DEPRECATED_SYMBOL_NAME (sym)); + SYMBOL_PRINT_NAME (sym)); break; } } @@ -2391,7 +2391,7 @@ scope_info (char *args, int from_tty) printf_filtered ("Scope for %s:\n", save_args); count++; - symname = DEPRECATED_SYMBOL_NAME (sym); + symname = SYMBOL_PRINT_NAME (sym); if (symname == NULL || *symname == '\0') continue; /* probably botched, certainly useless */ @@ -2458,7 +2458,7 @@ scope_info (char *args, int from_tty) printf_filtered ("%s", paddress (BLOCK_START (SYMBOL_BLOCK_VALUE (sym)))); break; case LOC_UNRESOLVED: - msym = lookup_minimal_symbol (DEPRECATED_SYMBOL_NAME (sym), + msym = lookup_minimal_symbol (SYMBOL_LINKAGE_NAME (sym), NULL, NULL); if (msym == NULL) printf_filtered ("Unresolved Static"); diff --git a/gdb/typeprint.c b/gdb/typeprint.c index 060c095852c..0ec0e267a8b 100644 --- a/gdb/typeprint.c +++ b/gdb/typeprint.c @@ -63,7 +63,7 @@ typedef_print (struct type *type, struct symbol *new, struct ui_file *stream) fprintf_filtered (stream, "typedef "); type_print (type, "", stream, 0); if (TYPE_NAME ((SYMBOL_TYPE (new))) == 0 - || strcmp (TYPE_NAME ((SYMBOL_TYPE (new))), DEPRECATED_SYMBOL_NAME (new)) != 0) + || strcmp (TYPE_NAME ((SYMBOL_TYPE (new))), SYMBOL_LINKAGE_NAME (new)) != 0) fprintf_filtered (stream, " %s", SYMBOL_PRINT_NAME (new)); break; #endif @@ -71,7 +71,7 @@ typedef_print (struct type *type, struct symbol *new, struct ui_file *stream) case language_m2: fprintf_filtered (stream, "TYPE "); if (!TYPE_NAME (SYMBOL_TYPE (new)) - || strcmp (TYPE_NAME ((SYMBOL_TYPE (new))), DEPRECATED_SYMBOL_NAME (new)) != 0) + || strcmp (TYPE_NAME ((SYMBOL_TYPE (new))), SYMBOL_LINKAGE_NAME (new)) != 0) fprintf_filtered (stream, "%s = ", SYMBOL_PRINT_NAME (new)); else fprintf_filtered (stream, "<builtin> = "); diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index edcd13d0a43..25fefca4fb7 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -1474,7 +1474,7 @@ process_xcoff_symbol (struct coff_symbol *cs, struct objfile *objfile) will be patched with the type from its stab entry later on in patch_block_stabs (), unless the file was compiled without -g. */ - DEPRECATED_SYMBOL_NAME (sym) = SYMNAME_ALLOC (name, symname_alloced); + SYMBOL_SET_LINKAGE_NAME (sym, SYMNAME_ALLOC (name, symname_alloced)); SYMBOL_TYPE (sym) = builtin_type (gdbarch)->nodebug_text_symbol; SYMBOL_CLASS (sym) = LOC_BLOCK; |