From 0d5cff5020224cfd67bc3d6e30b158105d03a324 Mon Sep 17 00:00:00 2001 From: Doug Evans Date: Tue, 7 Feb 2012 04:48:23 +0000 Subject: * 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. --- gdb/xcoffread.c | 43 ++++++++++++++++--------------------------- 1 file changed, 16 insertions(+), 27 deletions(-) (limited to 'gdb/xcoffread.c') diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index 1a2bb14..86ae8fb 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -882,7 +882,7 @@ enter_line_range (struct subfile *subfile, unsigned beginoffset, #define RECORD_MINIMAL_SYMBOL(NAME, ADDR, TYPE, SECTION, OBJFILE) \ { \ - char *namestr; \ + const char *namestr; \ \ namestr = (NAME); \ if (namestr[0] == '.') ++namestr; \ @@ -986,7 +986,7 @@ read_xcoff_symtab (struct partial_symtab *pst) char *filestring = " _start_ "; /* Name of the current file. */ - char *last_csect_name; /* Last seen csect's name and value. */ + const char *last_csect_name; /* Last seen csect's name and value. */ CORE_ADDR last_csect_val; int last_csect_sec; @@ -1989,10 +1989,6 @@ init_stringtab (bfd *abfd, file_ptr offset, struct objfile *objfile) for the psymtab. */ static unsigned int first_fun_line_offset; -static struct partial_symtab *xcoff_start_psymtab - (struct objfile *, char *, int, - struct partial_symbol **, struct partial_symbol **); - /* Allocate and partially fill a partial symtab. It will be completely filled at the end of the symbol list. @@ -2001,7 +1997,8 @@ static struct partial_symtab *xcoff_start_psymtab (normal). */ static struct partial_symtab * -xcoff_start_psymtab (struct objfile *objfile, char *filename, int first_symnum, +xcoff_start_psymtab (struct objfile *objfile, + const char *filename, int first_symnum, struct partial_symbol **global_syms, struct partial_symbol **static_syms) { @@ -2023,10 +2020,6 @@ xcoff_start_psymtab (struct objfile *objfile, char *filename, int first_symnum, return result; } -static struct partial_symtab *xcoff_end_psymtab - (struct partial_symtab *, char **, int, int, - struct partial_symtab **, int, int); - /* Close off the current usage of PST. Returns PST, or NULL if the partial symtab was empty and thrown away. @@ -2036,7 +2029,7 @@ static struct partial_symtab *xcoff_end_psymtab are the information for includes and dependencies. */ static struct partial_symtab * -xcoff_end_psymtab (struct partial_symtab *pst, char **include_list, +xcoff_end_psymtab (struct partial_symtab *pst, const char **include_list, int num_includes, int capping_symbol_number, struct partial_symtab **dependency_list, int number_dependencies, int textlow_not_set) @@ -2119,17 +2112,13 @@ xcoff_end_psymtab (struct partial_symtab *pst, char **include_list, return pst; } -static void swap_sym (struct internal_syment *, - union internal_auxent *, char **, char **, - unsigned int *, struct objfile *); - /* Swap raw symbol at *RAW and put the name in *NAME, the symbol in *SYMBOL, the first auxent in *AUX. Advance *RAW and *SYMNUMP over the symbol and its auxents. */ static void swap_sym (struct internal_syment *symbol, union internal_auxent *aux, - char **name, char **raw, unsigned int *symnump, + const char **name, char **raw, unsigned int *symnump, struct objfile *objfile) { bfd_coff_swap_sym_in (objfile->obfd, *raw, symbol); @@ -2189,9 +2178,9 @@ scan_xcoff_symtab (struct objfile *objfile) { struct gdbarch *gdbarch = get_objfile_arch (objfile); CORE_ADDR toc_offset = 0; /* toc offset value in data section. */ - char *filestring = NULL; + const char *filestring = NULL; - char *namestring; + const char *namestring; int past_first_source_file = 0; bfd *abfd; asection *bfd_sect; @@ -2201,7 +2190,7 @@ scan_xcoff_symtab (struct objfile *objfile) struct partial_symtab *pst; /* List of current psymtab's include files. */ - char **psymtab_include_list; + const char **psymtab_include_list; int includes_allocated; int includes_used; @@ -2214,7 +2203,7 @@ scan_xcoff_symtab (struct objfile *objfile) union internal_auxent main_aux[5]; unsigned int ssymnum; - char *last_csect_name = NULL; /* Last seen csect's name and value. */ + const char *last_csect_name = NULL; /* Last seen csect's name and value. */ CORE_ADDR last_csect_val = 0; int last_csect_sec = 0; int misc_func_recorded = 0; /* true if any misc. function. */ @@ -2224,8 +2213,8 @@ scan_xcoff_symtab (struct objfile *objfile) includes_allocated = 30; includes_used = 0; - psymtab_include_list = (char **) alloca (includes_allocated * - sizeof (char *)); + psymtab_include_list = (const char **) alloca (includes_allocated * + sizeof (const char *)); dependencies_allocated = 30; dependencies_used = 0; @@ -2619,13 +2608,13 @@ scan_xcoff_symtab (struct objfile *objfile) psymtab_include_list[includes_used++] = namestring; if (includes_used >= includes_allocated) { - char **orig = psymtab_include_list; + const char **orig = psymtab_include_list; - psymtab_include_list = (char **) + psymtab_include_list = (const char **) alloca ((includes_allocated *= 2) * - sizeof (char *)); + sizeof (const char *)); memcpy (psymtab_include_list, orig, - includes_used * sizeof (char *)); + includes_used * sizeof (const char *)); } continue; } -- cgit v1.1