aboutsummaryrefslogtreecommitdiff
path: root/gdb/symtab.c
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2012-02-07 04:48:23 +0000
committerDoug Evans <dje@google.com>2012-02-07 04:48:23 +0000
commit0d5cff5020224cfd67bc3d6e30b158105d03a324 (patch)
tree391b03bb5669edec5af9d377f1bdc4fbd0e9edc3 /gdb/symtab.c
parent7fda53d583bf5baaa15ccdea78c48bf57b205dad (diff)
downloadgdb-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/symtab.c')
-rw-r--r--gdb/symtab.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 61f7536..f746551 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -65,8 +65,6 @@
/* Prototypes for local functions */
-static void completion_list_add_name (char *, char *, int, char *, char *);
-
static void rbreak_command (char *, int);
static void types_info (char *, int);
@@ -366,9 +364,9 @@ gdb_mangle_name (struct type *type, int method_id, int signature_id)
char *mangled_name;
struct fn_field *f = TYPE_FN_FIELDLIST1 (type, method_id);
struct fn_field *method = &f[signature_id];
- char *field_name = TYPE_FN_FIELDLIST_NAME (type, method_id);
+ const char *field_name = TYPE_FN_FIELDLIST_NAME (type, method_id);
const char *physname = TYPE_FN_FIELD_PHYSNAME (f, signature_id);
- char *newname = type_name_no_tag (type);
+ const char *newname = type_name_no_tag (type);
/* Does the form of physname indicate that it is the full mangled name
of a constructor (not just the args)? */
@@ -478,7 +476,7 @@ symbol_set_demangled_name (struct general_symbol_info *gsymbol,
/* Return the demangled name of GSYMBOL. */
-char *
+const char *
symbol_get_demangled_name (const struct general_symbol_info *gsymbol)
{
if (gsymbol->language == language_cplus)
@@ -686,12 +684,14 @@ symbol_set_names (struct general_symbol_info *gsymbol,
name with the symbol, we don't need to use the same trick
as Java. */
if (!copy_name)
- gsymbol->name = (char *) linkage_name;
+ gsymbol->name = linkage_name;
else
{
- gsymbol->name = obstack_alloc (&objfile->objfile_obstack, len + 1);
- memcpy (gsymbol->name, linkage_name, len);
- gsymbol->name[len] = '\0';
+ char *name = obstack_alloc (&objfile->objfile_obstack, len + 1);
+
+ memcpy (name, linkage_name, len);
+ name[len] = '\0';
+ gsymbol->name = name;
}
symbol_set_demangled_name (gsymbol, NULL, NULL);
@@ -797,7 +797,7 @@ symbol_set_names (struct general_symbol_info *gsymbol,
/* Return the source code name of a symbol. In languages where
demangling is necessary, this is the demangled name. */
-char *
+const char *
symbol_natural_name (const struct general_symbol_info *gsymbol)
{
switch (gsymbol->language)
@@ -825,7 +825,7 @@ symbol_natural_name (const struct general_symbol_info *gsymbol)
/* Return the demangled name for a symbol based on the language for
that symbol. If no demangled name exists, return NULL. */
-char *
+const char *
symbol_demangled_name (const struct general_symbol_info *gsymbol)
{
switch (gsymbol->language)
@@ -855,7 +855,7 @@ symbol_demangled_name (const struct general_symbol_info *gsymbol)
If there is no distinct demangled name, then returns the same value
(same pointer) as SYMBOL_LINKAGE_NAME. */
-char *
+const char *
symbol_search_name (const struct general_symbol_info *gsymbol)
{
if (gsymbol->language == language_ada)
@@ -3833,8 +3833,9 @@ static char **return_val;
characters. If so, add it to the current completion list. */
static void
-completion_list_add_name (char *symname, char *sym_text, int sym_text_len,
- char *text, char *word)
+completion_list_add_name (const char *symname,
+ const char *sym_text, int sym_text_len,
+ const char *text, const char *word)
{
int newsize;
@@ -3882,13 +3883,14 @@ completion_list_add_name (char *symname, char *sym_text, int sym_text_len,
again and feed all the selectors into the mill. */
static void
-completion_list_objc_symbol (struct minimal_symbol *msymbol, char *sym_text,
- int sym_text_len, char *text, char *word)
+completion_list_objc_symbol (struct minimal_symbol *msymbol,
+ const char *sym_text, int sym_text_len,
+ const char *text, const char *word)
{
static char *tmp = NULL;
static unsigned int tmplen = 0;
- char *method, *category, *selector;
+ const char *method, *category, *selector;
char *tmp2 = NULL;
method = SYMBOL_NATURAL_NAME (msymbol);