diff options
author | Doug Evans <dje@google.com> | 2012-02-07 04:48:23 +0000 |
---|---|---|
committer | Doug Evans <dje@google.com> | 2012-02-07 04:48:23 +0000 |
commit | 0d5cff5020224cfd67bc3d6e30b158105d03a324 (patch) | |
tree | 391b03bb5669edec5af9d377f1bdc4fbd0e9edc3 /gdb/stabsread.c | |
parent | 7fda53d583bf5baaa15ccdea78c48bf57b205dad (diff) | |
download | gdb-0d5cff5020224cfd67bc3d6e30b158105d03a324.zip gdb-0d5cff5020224cfd67bc3d6e30b158105d03a324.tar.gz gdb-0d5cff5020224cfd67bc3d6e30b158105d03a324.tar.bz2 |
* gdbtypes.h (struct main_type): Change type of name,tag_name,
and fields.name members from char * to const char *. All uses updated.
(struct cplus_struct_type): Change type of fn_fieldlists.name member
from char * to const char *. All uses updated.
(type_name_no_tag): Update.
(lookup_unsigned_typename, lookup_signed_typename): Update.
* gdbtypes.c (type_name_no_tag): Change result type
from char * to const char *. All callers updated.
(lookup_unsigned_typename, lookup_signed_typename): Change type of
name parameter from char * to const char *.
* symtab.h (struct cplus_specific): Change type of demangled_name
member from char * to const char *. All uses updated.
(struct general_symbol_info): Change type of name and
mangled_lang.demangled_name members from char * to const char *.
All uses updated.
(symbol_get_demangled_name, symbol_natural_name): Update.
(symbol_demangled_name, symbol_search_name): Update.
* symtab.c (symbol_get_demangled_name): Change result type
from char * to const char *. All callers updated.
(symbol_natural_name, symbol_demangled_name): Ditto.
(symbol_search_name): Ditto.
(completion_list_add_name): Change type of symname,sym_text,
text,word parameters from char * to const char *.
(completion_list_objc_symbol): Change type of sym_text,
text,word parameters from char * to const char *.
* ada-lang.c (find_struct_field): Change type of name parameter
from char * to const char *.
(encoded_ordered_before): Similarly for N0,N1 parameters.
(old_renaming_is_invisible): Similarly for function_name parameter.
(ada_type_name): Change result type from char * to const char *.
All callers updated.
* ada-lang.h (ada_type_name): Update.
* buildsym.c (hashname): Change type of name parameter
from char * to const char *.
* buildsym.h (hashname): Update.
* dbxread.c (end_psymtab): Change type of include_list parameter
from char ** to const char **.
* dwarf2read.c (determine_prefix): Change result type
from char * to const char *. All callers updated.
* f-lang.c (find_common_for_function): Change type of name, funcname
parameters from char * to const char *.
* f-lang.c (find_common_for_function): Update.
* f-valprint.c (list_all_visible_commons): Change type of funcname
parameters from char * to const char *.
* gdbarch.sh (static_transform_name): Change type of name parameter
and result from char * to const char *.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* i386-sol2-tdep.c (i386_sol2_static_transform_name): Change type
of name parameter from char * to const char *.
* jv-lang.c (java_primitive_type_from_name): Ditto.
(java_demangled_signature_length): Similarly for signature parameter.
(java_demangled_signature_copy): Ditto.
(java_demangle_type_signature): Ditto.
* jv-lang.h (java_primitive_type_from_name): Update.
(java_demangle_type_signature): Update.
* objc-lang.c (specialcmp): Change type of a,b parameters
from char * to const char *.
* p-lang.c (is_pascal_string_type): Change type of arrayname parameter
from char * to const char *. All callers updated.
* p-lang.h (is_pascal_string_type): Update.
* solib-frv.c (find_canonical_descriptor_in_load_object): Change type
of name parameter from char * to const char *.
* sparc-sol2-tdep.c (sparc_sol2_static_transform_name): Ditto.
* utils.c (fprintf_symbol_filtered): Ditto.
* defs.h (fprintf_symbol_filtered): Update.
* sparc-tdep.h (sparc_sol2_static_transform_name): Update.
* stabsread.h (end_psymtab): Update.
* stack.c (find_frame_funname): Change type of funname parameter
from char ** to const char **.
* stack.h (find_frame_funname): Update.
* typeprint.c (type_print): Change type of varstring parameter
from char * to const char *.
* value.h (type_print): Update.
* xcoffread.c (xcoff_start_psymtab): Change type of filename parameter
from char * to const char *. All callers updated.
(xcoff_end_psymtab): Change type of include_list parameter
from char ** to const char **. All callers updated.
(swap_sym): Similarly for name parameter. All callers updated.
* coffread.c (patch_type): Add (char*) cast to xfree parameter.
Use xstrdup.
(process_coff_symbol): Use xstrdup.
* stabsread.c (stabs_method_name_from_physname): Renamed from
update_method_name_from_physname. Change result type from void
to char *. All callers updated.
(read_member_functions): In has_destructor case, store name in objfile
obstack instead of malloc space. In !has_stub case, fix mem leak.
Diffstat (limited to 'gdb/stabsread.c')
-rw-r--r-- | gdb/stabsread.c | 48 |
1 files changed, 27 insertions, 21 deletions
diff --git a/gdb/stabsread.c b/gdb/stabsread.c index e3811dd..afcfe06 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -1173,7 +1173,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, NULL, objfile); if (msym != NULL) { - char *new_name = gdbarch_static_transform_name + const char *new_name = gdbarch_static_transform_name (gdbarch, SYMBOL_LINKAGE_NAME (sym)); SYMBOL_SET_LINKAGE_NAME (sym, new_name); @@ -1367,7 +1367,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, NULL, objfile); if (msym != NULL) { - char *new_name = gdbarch_static_transform_name + const char *new_name = gdbarch_static_transform_name (gdbarch, SYMBOL_LINKAGE_NAME (sym)); SYMBOL_SET_LINKAGE_NAME (sym, new_name); @@ -2232,10 +2232,11 @@ rs6000_builtin_type (int typenum, struct objfile *objfile) /* This page contains subroutines of read_type. */ -/* Replace *OLD_NAME with the method name portion of PHYSNAME. */ +/* Wrapper around method_name_from_physname to flag a complaint + if there is an error. */ -static void -update_method_name_from_physname (char **old_name, const char *physname) +static char * +stabs_method_name_from_physname (const char *physname) { char *method_name; @@ -2245,16 +2246,10 @@ update_method_name_from_physname (char **old_name, const char *physname) { complaint (&symfile_complaints, _("Method has bad physname %s\n"), physname); - return; + return NULL; } - if (strcmp (*old_name, method_name) != 0) - { - xfree (*old_name); - *old_name = method_name; - } - else - xfree (method_name); + return method_name; } /* Read member function stabs info for C++ classes. The form of each member @@ -2687,14 +2682,24 @@ read_member_functions (struct field_info *fip, char **pp, struct type *type, - in -gstabs instead of -gstabs+ - or for static methods, which are output as a function type instead of a method type. */ + char *new_method_name = + stabs_method_name_from_physname (sublist->fn_field.physname); - update_method_name_from_physname (&new_fnlist->fn_fieldlist.name, - sublist->fn_field.physname); + if (new_method_name != NULL + && strcmp (new_method_name, + new_fnlist->fn_fieldlist.name) != 0) + { + new_fnlist->fn_fieldlist.name = new_method_name; + xfree (main_fn_name); + } + else + xfree (new_method_name); } else if (has_destructor && new_fnlist->fn_fieldlist.name[0] != '~') { new_fnlist->fn_fieldlist.name = - concat ("~", main_fn_name, (char *)NULL); + obconcat (&objfile->objfile_obstack, + "~", main_fn_name, (char *)NULL); xfree (main_fn_name); } else if (!has_stub) @@ -2711,6 +2716,7 @@ read_member_functions (struct field_info *fip, char **pp, struct type *type, new_fnlist->fn_fieldlist.name = obsavestring (dem_opname, strlen (dem_opname), &objfile->objfile_obstack); + xfree (main_fn_name); } new_fnlist->fn_fieldlist.fn_fields = (struct fn_field *) @@ -2753,7 +2759,7 @@ read_cpp_abbrev (struct field_info *fip, char **pp, struct type *type, struct objfile *objfile) { char *p; - char *name; + const char *name; char cpp_abbrev; struct type *context; @@ -3266,7 +3272,7 @@ read_tilde_fields (struct field_info *fip, char **pp, struct type *type, i >= TYPE_N_BASECLASSES (t); --i) { - char *name = TYPE_FIELD_NAME (t, i); + const char *name = TYPE_FIELD_NAME (t, i); if (!strncmp (name, vptr_name, sizeof (vptr_name) - 2) && is_cplus_marker (name[sizeof (vptr_name) - 2])) @@ -3406,8 +3412,8 @@ attach_fields_to_type (struct field_info *fip, struct type *type, static void complain_about_struct_wipeout (struct type *type) { - char *name = ""; - char *kind = ""; + const char *name = ""; + const char *kind = ""; if (TYPE_TAG_NAME (type)) { @@ -4545,7 +4551,7 @@ cleanup_undefined_types_1 (void) struct pending *ppt; int i; /* Name of the type, without "struct" or "union". */ - char *typename = TYPE_TAG_NAME (*type); + const char *typename = TYPE_TAG_NAME (*type); if (typename == NULL) { |