This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFA 1/2] Make names in gdbtypes.h,symtab.h const char *.
- From: dje at google dot com (Doug Evans)
- To: gdb-patches at sourceware dot org
- Date: Thu, 2 Feb 2012 14:49:38 -0800 (PST)
- Subject: [RFA 1/2] Make names in gdbtypes.h,symtab.h const char *.
Hi.
This set of patches started out as a very simple exercise. Heh. :-)
The concept is trivial: Change the name strings in gdbtypes.h,symtab.h
from char * to const char *. Except for a couple of special cases
(documented in gdbtypes.h), all names do not come from malloc space,
and are generally freed with the objfile.
Recording them as const char * is cleaner.
The patch is split into two because 95% of the changes are mechanical.
I've split the teensy bit that deserves mildly more review into patch 2/2.
Build-tested with --enable-targets=all.
Regression-tested on amd64-linux, and with -gstabs (since there's
a minor change to stabsread.c).
2012-02-02 Doug Evans <dje@google.com>
* 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
* p-lang.h (is_pascal_string_type): Update.
from char * to const char *. All callers updated.
* 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.
Index: ada-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/ada-lang.c,v
retrieving revision 1.335
diff -u -p -r1.335 ada-lang.c
--- ada-lang.c 1 Feb 2012 16:10:30 -0000 1.335
+++ ada-lang.c 2 Feb 2012 21:55:41 -0000
@@ -223,7 +223,7 @@ static struct value *ada_search_struct_f
static struct value *ada_value_primitive_field (struct value *, int, int,
struct type *);
-static int find_struct_field (char *, struct type *, int,
+static int find_struct_field (const char *, struct type *, int,
struct type **, int *, int *, int *, int *);
static struct value *ada_to_fixed_value_create (struct type *, CORE_ADDR,
@@ -1370,7 +1370,7 @@ ada_fixup_array_indexes_type (struct typ
/* Fixup each field of INDEX_DESC_TYPE. */
for (i = 0; i < TYPE_NFIELDS (index_desc_type); i++)
{
- char *name = TYPE_FIELD_NAME (index_desc_type, i);
+ const char *name = TYPE_FIELD_NAME (index_desc_type, i);
struct type *raw_type = ada_check_typedef (ada_find_any_type (name));
if (raw_type)
@@ -1962,8 +1962,8 @@ ada_is_unconstrained_packed_array_type (
static long
decode_packed_array_bitsize (struct type *type)
{
- char *raw_name;
- char *tail;
+ const char *raw_name;
+ const char *tail;
long bits;
/* Access to arrays implemented as fat pointers are encoded as a typedef
@@ -2042,9 +2042,9 @@ constrained_packed_array_type (struct ty
static struct type *
decode_constrained_packed_array_type (struct type *type)
{
- char *raw_name = ada_type_name (ada_check_typedef (type));
+ const char *raw_name = ada_type_name (ada_check_typedef (type));
char *name;
- char *tail;
+ const char *tail;
struct type *shadow_type;
long bits;
@@ -3407,7 +3407,7 @@ ada_resolve_function (struct ada_symbol_
such symbols by their trailing number (__N or $N). */
static int
-encoded_ordered_before (char *N0, char *N1)
+encoded_ordered_before (const char *N0, const char *N1)
{
if (N1 == NULL)
return 0;
@@ -4248,8 +4248,8 @@ lesseq_defined_than (struct symbol *sym0
{
struct type *type0 = SYMBOL_TYPE (sym0);
struct type *type1 = SYMBOL_TYPE (sym1);
- char *name0 = SYMBOL_LINKAGE_NAME (sym0);
- char *name1 = SYMBOL_LINKAGE_NAME (sym1);
+ const char *name0 = SYMBOL_LINKAGE_NAME (sym0);
+ const char *name1 = SYMBOL_LINKAGE_NAME (sym1);
int len0 = strlen (name0);
return
@@ -4380,7 +4380,7 @@ add_symbols_from_enclosing_procs (struct
static int
is_nondebugging_type (struct type *type)
{
- char *name = ada_type_name (type);
+ const char *name = ada_type_name (type);
return (name != NULL && strcmp (name, "<variable, no debug info>") == 0);
}
@@ -4411,8 +4411,8 @@ ada_identical_enum_types_p (struct type
suffix). */
for (i = 0; i < TYPE_NFIELDS (type1); i++)
{
- char *name_1 = TYPE_FIELD_NAME (type1, i);
- char *name_2 = TYPE_FIELD_NAME (type2, i);
+ const char *name_1 = TYPE_FIELD_NAME (type1, i);
+ const char *name_2 = TYPE_FIELD_NAME (type2, i);
int len_1 = strlen (name_1);
int len_2 = strlen (name_2);
@@ -4647,7 +4647,7 @@ is_package_name (const char *name)
not visible from FUNCTION_NAME. */
static int
-old_renaming_is_invisible (const struct symbol *sym, char *function_name)
+old_renaming_is_invisible (const struct symbol *sym, const char *function_name)
{
char *scope;
@@ -4717,7 +4717,7 @@ remove_irrelevant_renamings (struct ada_
int nsyms, const struct block *current_block)
{
struct symbol *current_function;
- char *current_function_name;
+ const char *current_function_name;
int i;
int is_new_style_renaming;
@@ -5854,7 +5854,7 @@ ada_make_symbol_completion_list (char *t
static int
ada_is_dispatch_table_ptr_type (struct type *type)
{
- char *name;
+ const char *name;
if (TYPE_CODE (type) != TYPE_CODE_PTR)
return 0;
@@ -6367,7 +6367,7 @@ ada_value_primitive_field (struct value
Returns 1 if found, 0 otherwise. */
static int
-find_struct_field (char *name, struct type *type, int offset,
+find_struct_field (const char *name, struct type *type, int offset,
struct type **field_type_p,
int *byte_offset_p, int *bit_offset_p, int *bit_size_p,
int *index_p)
@@ -6389,7 +6389,7 @@ find_struct_field (char *name, struct ty
{
int bit_pos = TYPE_FIELD_BITPOS (type, i);
int fld_offset = offset + bit_pos / 8;
- char *t_field_name = TYPE_FIELD_NAME (type, i);
+ const char *t_field_name = TYPE_FIELD_NAME (type, i);
if (t_field_name == NULL)
continue;
@@ -6466,7 +6466,7 @@ ada_search_struct_field (char *name, str
type = ada_check_typedef (type);
for (i = 0; i < TYPE_NFIELDS (type); i += 1)
{
- char *t_field_name = TYPE_FIELD_NAME (type, i);
+ const char *t_field_name = TYPE_FIELD_NAME (type, i);
if (t_field_name == NULL)
continue;
@@ -6725,7 +6725,7 @@ ada_lookup_struct_elt_type (struct type
for (i = 0; i < TYPE_NFIELDS (type); i += 1)
{
- char *t_field_name = TYPE_FIELD_NAME (type, i);
+ const char *t_field_name = TYPE_FIELD_NAME (type, i);
struct type *t;
int disp;
@@ -6764,7 +6764,7 @@ ada_lookup_struct_elt_type (struct type
NOT wrapped in a struct, since the compiler sometimes
generates these for unchecked variant types. Revisit
if the compiler changes this practice. */
- char *v_field_name = TYPE_FIELD_NAME (field_type, j);
+ const char *v_field_name = TYPE_FIELD_NAME (field_type, j);
disp = 0;
if (v_field_name != NULL
&& field_name_match (v_field_name, name))
@@ -7030,7 +7030,7 @@ find_old_style_renaming_symbol (const ch
qualified. This means we need to prepend the function name
as well as adding the ``___XR'' suffix to build the name of
the associated renaming symbol. */
- char *function_name = SYMBOL_LINKAGE_NAME (function_sym);
+ const char *function_name = SYMBOL_LINKAGE_NAME (function_sym);
/* Function names sometimes contain suffixes used
for instance to qualify nested subprograms. When building
the XR type name, we need to make sure that this suffix is
@@ -7110,7 +7110,7 @@ ada_prefer_type (struct type *type0, str
/* The name of TYPE, which is either its TYPE_NAME, or, if that is
null, its TYPE_TAG_NAME. Null if TYPE is null. */
-char *
+const char *
ada_type_name (struct type *type)
{
if (type == NULL)
@@ -7137,7 +7137,7 @@ find_parallel_type_by_descriptive_type (
result = TYPE_DESCRIPTIVE_TYPE (type);
while (result != NULL)
{
- char *result_name = ada_type_name (result);
+ const char *result_name = ada_type_name (result);
if (result_name == NULL)
{
@@ -7189,7 +7189,8 @@ ada_find_parallel_type_with_name (struct
struct type *
ada_find_parallel_type (struct type *type, const char *suffix)
{
- char *name, *typename = ada_type_name (type);
+ char *name;
+ const char *typename = ada_type_name (type);
int len;
if (typename == NULL)
@@ -7895,7 +7896,7 @@ ada_to_fixed_type_1 (struct type *type,
If there is, then it provides the actual size of our type. */
else if (ada_type_name (fixed_record_type) != NULL)
{
- char *name = ada_type_name (fixed_record_type);
+ const char *name = ada_type_name (fixed_record_type);
char *xvz_name = alloca (strlen (name) + 7 /* "___XVZ\0" */);
int xvz_found = 0;
LONGEST size;
@@ -8090,7 +8091,7 @@ ada_check_typedef (struct type *type)
return type;
else
{
- char *name = TYPE_TAG_NAME (type);
+ const char *name = TYPE_TAG_NAME (type);
struct type *type1 = ada_find_any_type (name);
if (type1 == NULL)
@@ -8870,7 +8871,7 @@ aggregate_assign_from_choices (struct va
else
{
int ind;
- char *name;
+ const char *name;
switch (op)
{
@@ -9879,7 +9880,7 @@ ada_evaluate_subexp (struct type *expect
else if (discrete_type_p (type_arg))
{
struct type *range_type;
- char *name = ada_type_name (type_arg);
+ const char *name = ada_type_name (type_arg);
range_type = NULL;
if (name != NULL && TYPE_CODE (type_arg) != TYPE_CODE_ENUM)
@@ -10411,7 +10412,7 @@ get_int_var_value (char *name, int *flag
static struct type *
to_fixed_range_type (struct type *raw_type, struct value *dval)
{
- char *name;
+ const char *name;
struct type *base_type;
char *subtype_info;
@@ -10534,8 +10535,8 @@ ada_is_modular_type (struct type *type)
int
ada_modulus_from_name (struct type *type, ULONGEST *modulus)
{
- char *name = ada_type_name (type);
- char *suffix;
+ const char *name = ada_type_name (type);
+ const char *suffix;
int k;
LONGEST U;
@@ -10781,7 +10782,7 @@ static int
is_known_support_routine (struct frame_info *frame)
{
struct symtab_and_line sal;
- char *func_name;
+ const char *func_name;
enum language func_lang;
int i;
@@ -10884,7 +10885,7 @@ ada_unhandled_exception_name_addr_from_r
while (fi != NULL)
{
- char *func_name;
+ const char *func_name;
enum language func_lang;
find_frame_funname (fi, &func_name, &func_lang, NULL);
Index: ada-lang.h
===================================================================
RCS file: /cvs/src/src/gdb/ada-lang.h,v
retrieving revision 1.71
diff -u -p -r1.71 ada-lang.h
--- ada-lang.h 1 Feb 2012 15:49:34 -0000 1.71
+++ ada-lang.h 2 Feb 2012 21:55:41 -0000
@@ -322,7 +322,7 @@ extern struct type *ada_template_to_fixe
extern int ada_name_prefix_len (const char *);
-extern char *ada_type_name (struct type *);
+extern const char *ada_type_name (struct type *);
extern struct type *ada_find_parallel_type (struct type *,
const char *suffix);
Index: ada-typeprint.c
===================================================================
RCS file: /cvs/src/src/gdb/ada-typeprint.c,v
retrieving revision 1.44
diff -u -p -r1.44 ada-typeprint.c
--- ada-typeprint.c 4 Jan 2012 08:16:55 -0000 1.44
+++ ada-typeprint.c 2 Feb 2012 21:55:41 -0000
@@ -76,7 +76,7 @@ decoded_type_name (struct type *type)
return NULL;
else
{
- char *raw_name = ada_type_name (type);
+ const char *raw_name = ada_type_name (type);
char *s, *q;
if (name_buffer == NULL || name_buffer_len <= strlen (raw_name))
@@ -223,9 +223,9 @@ print_dynamic_range_bound (struct type *
static void
print_range_type (struct type *raw_type, struct ui_file *stream)
{
- char *name;
+ const char *name;
struct type *base_type;
- char *subtype_info;
+ const char *subtype_info;
gdb_assert (raw_type != NULL);
name = TYPE_NAME (raw_type);
@@ -810,7 +810,7 @@ ada_print_type (struct type *type0, cons
print_fixed_point_type (type, stream);
else
{
- char *name = ada_type_name (type);
+ const char *name = ada_type_name (type);
if (!ada_is_range_type_name (name))
fprintf_filtered (stream, _("<%d-byte integer>"),
Index: arm-wince-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-wince-tdep.c,v
retrieving revision 1.15
diff -u -p -r1.15 arm-wince-tdep.c
--- arm-wince-tdep.c 4 Jan 2012 08:16:58 -0000 1.15
+++ arm-wince-tdep.c 2 Feb 2012 21:55:41 -0000
@@ -44,7 +44,7 @@ arm_pe_skip_trampoline_code (struct fram
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
ULONGEST indirect;
struct minimal_symbol *indsym;
- char *symname;
+ const char *symname;
CORE_ADDR next_pc;
/* The format of an ARM DLL trampoline is:
Index: ax-gdb.c
===================================================================
RCS file: /cvs/src/src/gdb/ax-gdb.c,v
retrieving revision 1.91
diff -u -p -r1.91 ax-gdb.c
--- ax-gdb.c 4 Jan 2012 08:16:59 -0000 1.91
+++ ax-gdb.c 2 Feb 2012 21:55:41 -0000
@@ -1477,7 +1477,7 @@ gen_struct_ref_recursive (struct express
for (i = TYPE_NFIELDS (type) - 1; i >= nbases; i--)
{
- char *this_name = TYPE_FIELD_NAME (type, i);
+ const char *this_name = TYPE_FIELD_NAME (type, i);
if (this_name)
{
@@ -1625,7 +1625,7 @@ gen_struct_elt_for_reference (struct exp
for (i = TYPE_NFIELDS (t) - 1; i >= TYPE_N_BASECLASSES (t); i--)
{
- char *t_field_name = TYPE_FIELD_NAME (t, i);
+ const char *t_field_name = TYPE_FIELD_NAME (t, i);
if (t_field_name && strcmp (t_field_name, fieldname) == 0)
{
Index: buildsym.c
===================================================================
RCS file: /cvs/src/src/gdb/buildsym.c,v
retrieving revision 1.90
diff -u -p -r1.90 buildsym.c
--- buildsym.c 4 Jan 2012 08:16:59 -0000 1.90
+++ buildsym.c 2 Feb 2012 21:55:41 -0000
@@ -151,7 +151,7 @@ struct symbol *
find_symbol_in_list (struct pending *list, char *name, int length)
{
int j;
- char *pp;
+ const char *pp;
while (list != NULL)
{
@@ -1251,7 +1251,7 @@ pop_context (void)
/* Compute a small integer hash code for the given name. */
int
-hashname (char *name)
+hashname (const char *name)
{
return (hash(name,strlen(name)) % HASHSIZE);
}
Index: buildsym.h
===================================================================
RCS file: /cvs/src/src/gdb/buildsym.h,v
retrieving revision 1.29
diff -u -p -r1.29 buildsym.h
--- buildsym.h 4 Jan 2012 08:16:59 -0000 1.29
+++ buildsym.h 2 Feb 2012 21:55:41 -0000
@@ -279,7 +279,7 @@ extern void record_line (struct subfile
extern void start_symtab (char *name, char *dirname, CORE_ADDR start_addr);
-extern int hashname (char *name);
+extern int hashname (const char *name);
extern void free_pending_blocks (void);
Index: c-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/c-lang.c,v
retrieving revision 1.97
diff -u -p -r1.97 c-lang.c
--- c-lang.c 26 Jan 2012 04:20:36 -0000 1.97
+++ c-lang.c 2 Feb 2012 21:55:41 -0000
@@ -87,7 +87,7 @@ classify_type (struct type *elttype, str
that would do the wrong thing. */
while (elttype)
{
- char *name = TYPE_NAME (elttype);
+ const char *name = TYPE_NAME (elttype);
if (TYPE_CODE (elttype) == TYPE_CODE_CHAR || !name)
{
Index: c-typeprint.c
===================================================================
RCS file: /cvs/src/src/gdb/c-typeprint.c,v
retrieving revision 1.72
diff -u -p -r1.72 c-typeprint.c
--- c-typeprint.c 4 Jan 2012 08:17:00 -0000 1.72
+++ c-typeprint.c 2 Feb 2012 21:55:41 -0000
@@ -142,7 +142,7 @@ static void
cp_type_print_derivation_info (struct ui_file *stream,
struct type *type)
{
- char *name;
+ const char *name;
int i;
for (i = 0; i < TYPE_N_BASECLASSES (type); i++)
@@ -165,8 +165,8 @@ cp_type_print_derivation_info (struct ui
/* Print the C++ method arguments ARGS to the file STREAM. */
static void
-cp_type_print_method_args (struct type *mtype, char *prefix,
- char *varstring, int staticp,
+cp_type_print_method_args (struct type *mtype, const char *prefix,
+ const char *varstring, int staticp,
struct ui_file *stream)
{
struct field *args = TYPE_FIELDS (mtype);
@@ -238,7 +238,7 @@ c_type_print_varspec_prefix (struct type
int show, int passed_a_ptr,
int need_post_space)
{
- char *name;
+ const char *name;
if (type == 0)
return;
@@ -471,7 +471,7 @@ is_type_conversion_operator (struct type
by their name is pretty terrible. But I don't think our present
data structure gives us any other way to tell. If you know of
some other way, feel free to rewrite this function. */
- char *name = TYPE_FN_FIELDLIST_NAME (type, i);
+ const char *name = TYPE_FN_FIELDLIST_NAME (type, i);
if (strncmp (name, "operator", 8) != 0)
return 0;
@@ -990,8 +990,8 @@ c_type_print_base (struct type *type, st
{
struct fn_field *f = TYPE_FN_FIELDLIST1 (type, i);
int j, len2 = TYPE_FN_FIELDLIST_LENGTH (type, i);
- char *method_name = TYPE_FN_FIELDLIST_NAME (type, i);
- char *name = type_name_no_tag (type);
+ const char *method_name = TYPE_FN_FIELDLIST_NAME (type, i);
+ const char *name = type_name_no_tag (type);
int is_constructor = name && strcmp (method_name,
name) == 0;
Index: completer.c
===================================================================
RCS file: /cvs/src/src/gdb/completer.c,v
retrieving revision 1.46
diff -u -p -r1.46 completer.c
--- completer.c 4 Jan 2012 08:17:00 -0000 1.46
+++ completer.c 2 Feb 2012 21:55:41 -0000
@@ -386,7 +386,7 @@ add_struct_fields (struct type *type, in
{
int i;
int computed_type_name = 0;
- char *type_name = NULL;
+ const char *type_name = NULL;
CHECK_TYPEDEF (type);
for (i = 0; i < TYPE_NFIELDS (type); ++i)
@@ -416,7 +416,7 @@ add_struct_fields (struct type *type, in
for (i = TYPE_NFN_FIELDS (type) - 1; i >= 0; --i)
{
- char *name = TYPE_FN_FIELDLIST_NAME (type, i);
+ const char *name = TYPE_FN_FIELDLIST_NAME (type, i);
if (name && ! strncmp (name, fieldname, namelen))
{
Index: cp-support.c
===================================================================
RCS file: /cvs/src/src/gdb/cp-support.c,v
retrieving revision 1.53
diff -u -p -r1.53 cp-support.c
--- cp-support.c 10 Jan 2012 19:29:12 -0000 1.53
+++ cp-support.c 2 Feb 2012 21:55:41 -0000
@@ -1205,7 +1205,7 @@ make_symbol_overload_list_adl_namespace
const char *func_name)
{
char *namespace;
- char *type_name;
+ const char *type_name;
int i, prefix_len;
while (TYPE_CODE (type) == TYPE_CODE_PTR
Index: cp-valprint.c
===================================================================
RCS file: /cvs/src/src/gdb/cp-valprint.c,v
retrieving revision 1.80
diff -u -p -r1.80 cp-valprint.c
--- cp-valprint.c 4 Jan 2012 08:17:00 -0000 1.80
+++ cp-valprint.c 2 Feb 2012 21:55:41 -0000
@@ -98,7 +98,7 @@ const char vtbl_ptr_name[] = "__vtbl_ptr
int
cp_is_vtbl_ptr_type (struct type *type)
{
- char *typename = type_name_no_tag (type);
+ const char *typename = type_name_no_tag (type);
return (typename != NULL && !strcmp (typename, vtbl_ptr_name));
}
@@ -495,7 +495,7 @@ cp_print_value (struct type *type, struc
int boffset = 0;
int skip;
struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i));
- char *basename = TYPE_NAME (baseclass);
+ const char *basename = TYPE_NAME (baseclass);
const gdb_byte *base_valaddr = NULL;
const struct value *base_val = NULL;
volatile struct gdb_exception ex;
@@ -794,7 +794,7 @@ cp_print_class_member (const gdb_byte *v
if (domain != NULL)
{
- char *name;
+ const char *name;
fputs_filtered (prefix, stream);
name = type_name_no_tag (domain);
Index: dbxread.c
===================================================================
RCS file: /cvs/src/src/gdb/dbxread.c,v
retrieving revision 1.132
diff -u -p -r1.132 dbxread.c
--- dbxread.c 4 Jan 2012 08:17:00 -0000 1.132
+++ dbxread.c 2 Feb 2012 21:55:41 -0000
@@ -1210,7 +1210,7 @@ read_dbx_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;
@@ -1232,8 +1232,8 @@ read_dbx_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;
@@ -1635,12 +1635,12 @@ read_dbx_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 **)
- alloca ((includes_allocated *= 2) * sizeof (char *));
+ psymtab_include_list = (const char **)
+ alloca ((includes_allocated *= 2) * sizeof (const char *));
memcpy (psymtab_include_list, orig,
- includes_used * sizeof (char *));
+ includes_used * sizeof (const char *));
}
continue;
}
@@ -2226,7 +2226,8 @@ start_psymtab (struct objfile *objfile,
FIXME: List variables and peculiarities of same. */
struct partial_symtab *
-end_psymtab (struct partial_symtab *pst, char **include_list, int num_includes,
+end_psymtab (struct partial_symtab *pst,
+ const char **include_list, int num_includes,
int capping_symbol_offset, CORE_ADDR capping_text,
struct partial_symtab **dependency_list, int number_dependencies,
int textlow_not_set)
Index: defs.h
===================================================================
RCS file: /cvs/src/src/gdb/defs.h,v
retrieving revision 1.309
diff -u -p -r1.309 defs.h
--- defs.h 20 Jan 2012 09:49:01 -0000 1.309
+++ defs.h 2 Feb 2012 21:55:41 -0000
@@ -582,7 +582,7 @@ extern CORE_ADDR string_to_core_addr (co
extern char *hex_string (LONGEST);
extern char *hex_string_custom (LONGEST, int);
-extern void fprintf_symbol_filtered (struct ui_file *, char *,
+extern void fprintf_symbol_filtered (struct ui_file *, const char *,
enum language, int);
extern void perror_with_name (const char *) ATTRIBUTE_NORETURN;
Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.611
diff -u -p -r1.611 dwarf2read.c
--- dwarf2read.c 30 Jan 2012 20:10:32 -0000 1.611
+++ dwarf2read.c 2 Feb 2012 21:55:41 -0000
@@ -1029,7 +1029,7 @@ static struct type *read_type_die (struc
static struct type *read_type_die_1 (struct die_info *, struct dwarf2_cu *);
-static char *determine_prefix (struct die_info *die, struct dwarf2_cu *);
+static const char *determine_prefix (struct die_info *die, struct dwarf2_cu *);
static char *typename_concat (struct obstack *obs, const char *prefix,
const char *suffix, int physname,
@@ -5013,7 +5013,7 @@ dwarf2_compute_name (char *name, struct
if (die_needs_namespace (die, cu))
{
long length;
- char *prefix;
+ const char *prefix;
struct ui_file *buf;
prefix = determine_prefix (die, cu);
@@ -7729,7 +7729,7 @@ process_structure_scope (struct die_info
i >= TYPE_N_BASECLASSES (t);
--i)
{
- char *fieldname = TYPE_FIELD_NAME (t, i);
+ const char *fieldname = TYPE_FIELD_NAME (t, i);
if (is_vtable_name (fieldname, cu))
{
@@ -12479,7 +12479,7 @@ anonymous_struct_prefix (struct die_info
then determine_prefix on foo's die will return "N::C". */
-static char *
+static const char *
determine_prefix (struct die_info *die, struct dwarf2_cu *cu)
{
struct die_info *parent, *spec_die;
Index: eval.c
===================================================================
RCS file: /cvs/src/src/gdb/eval.c,v
retrieving revision 1.157
diff -u -p -r1.157 eval.c
--- eval.c 9 Jan 2012 20:27:48 -0000 1.157
+++ eval.c 2 Feb 2012 21:55:41 -0000
@@ -335,7 +335,8 @@ evaluate_struct_tuple (struct value *str
for (fieldno = 0; fieldno < TYPE_NFIELDS (struct_type);
fieldno++)
{
- char *field_name = TYPE_FIELD_NAME (struct_type, fieldno);
+ const char *field_name =
+ TYPE_FIELD_NAME (struct_type, fieldno);
if (field_name != NULL && strcmp (field_name, label) == 0)
{
@@ -348,7 +349,8 @@ evaluate_struct_tuple (struct value *str
for (fieldno = 0; fieldno < TYPE_NFIELDS (struct_type);
fieldno++)
{
- char *field_name = TYPE_FIELD_NAME (struct_type, fieldno);
+ const char *field_name =
+ TYPE_FIELD_NAME (struct_type, fieldno);
field_type = TYPE_FIELD_TYPE (struct_type, fieldno);
if ((field_name == 0 || *field_name == '\0')
Index: f-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/f-lang.c,v
retrieving revision 1.69
diff -u -p -r1.69 f-lang.c
--- f-lang.c 26 Jan 2012 04:20:36 -0000 1.69
+++ f-lang.c 2 Feb 2012 21:55:41 -0000
@@ -572,7 +572,7 @@ find_first_common_named (char *name)
that belongs to function funcname. */
SAVED_F77_COMMON_PTR
-find_common_for_function (char *name, char *funcname)
+find_common_for_function (const char *name, const char *funcname)
{
SAVED_F77_COMMON_PTR tmp;
Index: f-lang.h
===================================================================
RCS file: /cvs/src/src/gdb/f-lang.h,v
retrieving revision 1.22
diff -u -p -r1.22 f-lang.h
--- f-lang.h 4 Jan 2012 08:17:02 -0000 1.22
+++ f-lang.h 2 Feb 2012 21:55:41 -0000
@@ -75,7 +75,8 @@ extern SAVED_F77_COMMON_PTR head_common_
extern SAVED_F77_COMMON_PTR tail_common_list; /* Ptr to last saved COMMON */
extern SAVED_F77_COMMON_PTR current_common; /* Ptr to current COMMON */
-extern SAVED_F77_COMMON_PTR find_common_for_function (char *, char *);
+extern SAVED_F77_COMMON_PTR find_common_for_function (const char *,
+ const char *);
#define UNINITIALIZED_SECNUM -1
#define COMMON_NEEDS_PATCHING(blk) ((blk)->secnum == UNINITIALIZED_SECNUM)
Index: f-valprint.c
===================================================================
RCS file: /cvs/src/src/gdb/f-valprint.c,v
retrieving revision 1.69
diff -u -p -r1.69 f-valprint.c
--- f-valprint.c 4 Jan 2012 08:17:02 -0000 1.69
+++ f-valprint.c 2 Feb 2012 21:55:41 -0000
@@ -41,7 +41,7 @@ static int there_is_a_visible_common_nam
extern void _initialize_f_valprint (void);
static void info_common_command (char *, int);
-static void list_all_visible_commons (char *);
+static void list_all_visible_commons (const char *);
static void f77_create_arrayprint_offset_tbl (struct type *,
struct ui_file *);
static void f77_get_dynamic_length_of_aggregate (struct type *);
@@ -518,7 +518,7 @@ f_val_print (struct type *type, const gd
}
static void
-list_all_visible_commons (char *funname)
+list_all_visible_commons (const char *funname)
{
SAVED_F77_COMMON_PTR tmp;
@@ -545,7 +545,7 @@ info_common_command (char *comname, int
SAVED_F77_COMMON_PTR the_common;
COMMON_ENTRY_PTR entry;
struct frame_info *fi;
- char *funname = 0;
+ const char *funname = 0;
struct symbol *func;
/* We have been told to display the contents of F77 COMMON
Index: gdbarch.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.c,v
retrieving revision 1.484
diff -u -p -r1.484 gdbarch.c
--- gdbarch.c 2 Feb 2012 20:19:13 -0000 1.484
+++ gdbarch.c 2 Feb 2012 21:55:41 -0000
@@ -3646,8 +3646,8 @@ gdbarch_static_transform_name_p (struct
return gdbarch->static_transform_name != NULL;
}
-char *
-gdbarch_static_transform_name (struct gdbarch *gdbarch, char *name)
+const char *
+gdbarch_static_transform_name (struct gdbarch *gdbarch, const char *name)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->static_transform_name != NULL);
Index: gdbarch.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.h,v
retrieving revision 1.433
diff -u -p -r1.433 gdbarch.h
--- gdbarch.h 2 Feb 2012 20:19:13 -0000 1.433
+++ gdbarch.h 2 Feb 2012 21:55:41 -0000
@@ -909,8 +909,8 @@ extern void set_gdbarch_core_read_descri
extern int gdbarch_static_transform_name_p (struct gdbarch *gdbarch);
-typedef char * (gdbarch_static_transform_name_ftype) (char *name);
-extern char * gdbarch_static_transform_name (struct gdbarch *gdbarch, char *name);
+typedef const char * (gdbarch_static_transform_name_ftype) (const char *name);
+extern const char * gdbarch_static_transform_name (struct gdbarch *gdbarch, const char *name);
extern void set_gdbarch_static_transform_name (struct gdbarch *gdbarch, gdbarch_static_transform_name_ftype *static_transform_name);
/* Set if the address in N_SO or N_FUN stabs may be zero. */
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.532
diff -u -p -r1.532 gdbarch.sh
--- gdbarch.sh 2 Feb 2012 20:19:14 -0000 1.532
+++ gdbarch.sh 2 Feb 2012 21:55:41 -0000
@@ -758,7 +758,7 @@ F:void:overlay_update:struct obj_section
M:const struct target_desc *:core_read_description:struct target_ops *target, bfd *abfd:target, abfd
# Handle special encoding of static variables in stabs debug info.
-F:char *:static_transform_name:char *name:name
+F:const char *:static_transform_name:const char *name:name
# Set if the address in N_SO or N_FUN stabs may be zero.
v:int:sofun_address_maybe_missing:::0:0::0
Index: gdbtypes.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtypes.c,v
retrieving revision 1.225
diff -u -p -r1.225 gdbtypes.c
--- gdbtypes.c 9 Jan 2012 22:31:39 -0000 1.225
+++ gdbtypes.c 2 Feb 2012 21:55:41 -0000
@@ -1092,7 +1092,7 @@ smash_to_method_type (struct type *type,
/* Return a typename for a struct/union/enum type without "struct ",
"union ", or "enum ". If the type has a NULL name, return NULL. */
-char *
+const char *
type_name_no_tag (const struct type *type)
{
if (TYPE_TAG_NAME (type) != NULL)
@@ -1164,7 +1164,7 @@ lookup_typename (const struct language_d
struct type *
lookup_unsigned_typename (const struct language_defn *language,
- struct gdbarch *gdbarch, char *name)
+ struct gdbarch *gdbarch, const char *name)
{
char *uns = alloca (strlen (name) + 10);
@@ -1175,7 +1175,7 @@ lookup_unsigned_typename (const struct l
struct type *
lookup_signed_typename (const struct language_defn *language,
- struct gdbarch *gdbarch, char *name)
+ struct gdbarch *gdbarch, const char *name)
{
struct type *t;
char *uns = alloca (strlen (name) + 8);
@@ -1338,7 +1338,7 @@ lookup_struct_elt_type (struct type *typ
for (i = TYPE_NFIELDS (type) - 1; i >= TYPE_N_BASECLASSES (type); i--)
{
- char *t_field_name = TYPE_FIELD_NAME (type, i);
+ const char *t_field_name = TYPE_FIELD_NAME (type, i);
if (t_field_name && (strcmp_iw (t_field_name, name) == 0))
{
@@ -1480,7 +1480,7 @@ check_typedef (struct type *type)
{
if (!TYPE_TARGET_TYPE (type))
{
- char *name;
+ const char *name;
struct symbol *sym;
/* It is dangerous to call lookup_symbol if we are currently
@@ -1543,7 +1543,7 @@ check_typedef (struct type *type)
&& opaque_type_resolution
&& !currently_reading_symtab)
{
- char *name = type_name_no_tag (type);
+ const char *name = type_name_no_tag (type);
struct type *newtype;
if (name == NULL)
@@ -1577,7 +1577,7 @@ check_typedef (struct type *type)
types. */
else if (TYPE_STUB (type) && !currently_reading_symtab)
{
- char *name = type_name_no_tag (type);
+ const char *name = type_name_no_tag (type);
/* FIXME: shouldn't we separately check the TYPE_NAME and the
TYPE_TAG_NAME, and look in STRUCT_DOMAIN and/or VAR_DOMAIN
as appropriate? (this code was written before TYPE_NAME and
Index: gdbtypes.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbtypes.h,v
retrieving revision 1.161
diff -u -p -r1.161 gdbtypes.h
--- gdbtypes.h 16 Jan 2012 19:44:14 -0000 1.161
+++ gdbtypes.h 2 Feb 2012 21:55:41 -0000
@@ -436,9 +436,11 @@ struct main_type
/* Name of this type, or NULL if none.
This is used for printing only, except by poorly designed C++ code.
- For looking up a name, look for a symbol in the VAR_DOMAIN. */
+ For looking up a name, look for a symbol in the VAR_DOMAIN.
+ This is generally allocated in the objfile's obstack.
+ However coffread.c uses malloc. */
- char *name;
+ const char *name;
/* Tag name for this type, or NULL if none. This means that the
name of the type consists of a keyword followed by the tag name.
@@ -451,7 +453,7 @@ struct main_type
One more legitimate use is that if TYPE_FLAG_STUB is set, this is
the name to use to look for definitions in other files. */
- char *tag_name;
+ const char *tag_name;
/* Every type is now associated with a particular objfile, and the
type is allocated on the objfile_obstack for that objfile. One problem
@@ -556,7 +558,7 @@ struct main_type
NULL for range bounds, array domains, and member function
arguments. */
- char *name;
+ const char *name;
} *fields;
/* Union member used for range types. */
@@ -761,9 +763,11 @@ struct cplus_struct_type
struct fn_fieldlist
{
- /* The overloaded name. */
+ /* The overloaded name.
+ This is generally allocated in the objfile's obstack.
+ However stabsread.c sometimes uses malloc. */
- char *name;
+ const char *name;
/* The number of methods with this name. */
@@ -1461,7 +1465,7 @@ extern void smash_to_methodptr_type (str
extern struct type *allocate_stub_method (struct type *);
-extern char *type_name_no_tag (const struct type *);
+extern const char *type_name_no_tag (const struct type *);
extern const char *type_name_no_tag_or_error (struct type *type);
@@ -1489,10 +1493,10 @@ extern struct type *lookup_string_range_
extern struct type *create_set_type (struct type *, struct type *);
extern struct type *lookup_unsigned_typename (const struct language_defn *,
- struct gdbarch *,char *);
+ struct gdbarch *, const char *);
extern struct type *lookup_signed_typename (const struct language_defn *,
- struct gdbarch *,char *);
+ struct gdbarch *, const char *);
extern struct type *check_typedef (struct type *);
Index: gnu-v2-abi.c
===================================================================
RCS file: /cvs/src/src/gdb/gnu-v2-abi.c,v
retrieving revision 1.43
diff -u -p -r1.43 gnu-v2-abi.c
--- gnu-v2-abi.c 4 Jan 2012 08:17:03 -0000 1.43
+++ gnu-v2-abi.c 2 Feb 2012 21:55:41 -0000
@@ -194,6 +194,7 @@ gnuv2_value_rtti_type (struct value *v,
CORE_ADDR vtbl;
struct minimal_symbol *minsym;
char *demangled_name, *p;
+ const char *linkage_name;
struct type *btype;
struct type *known_type_vptr_basetype;
int known_type_vptr_fieldno;
@@ -246,12 +247,12 @@ gnuv2_value_rtti_type (struct value *v,
/* Try to find a symbol that is the vtable. */
minsym=lookup_minimal_symbol_by_pc(vtbl);
if (minsym==NULL
- || (demangled_name=SYMBOL_LINKAGE_NAME (minsym))==NULL
- || !is_vtable_name (demangled_name))
+ || (linkage_name=SYMBOL_LINKAGE_NAME (minsym))==NULL
+ || !is_vtable_name (linkage_name))
return NULL;
/* If we just skip the prefix, we get screwed by namespaces. */
- demangled_name=cplus_demangle(demangled_name,DMGL_PARAMS|DMGL_ANSI);
+ demangled_name=cplus_demangle(linkage_name,DMGL_PARAMS|DMGL_ANSI);
p = strchr (demangled_name, ' ');
if (p)
*p = '\0';
@@ -297,8 +298,8 @@ static int
vb_match (struct type *type, int index, struct type *basetype)
{
struct type *fieldtype;
- char *name = TYPE_FIELD_NAME (type, index);
- char *field_class_name = NULL;
+ const char *name = TYPE_FIELD_NAME (type, index);
+ const char *field_class_name = NULL;
if (*name != '_')
return 0;
Index: gnu-v3-abi.c
===================================================================
RCS file: /cvs/src/src/gdb/gnu-v3-abi.c,v
retrieving revision 1.68
diff -u -p -r1.68 gnu-v3-abi.c
--- gnu-v3-abi.c 4 Jan 2012 08:17:03 -0000 1.68
+++ gnu-v3-abi.c 2 Feb 2012 21:55:41 -0000
@@ -735,7 +735,7 @@ gnuv3_skip_trampoline (struct frame_info
struct gdbarch *gdbarch = get_frame_arch (frame);
struct minimal_symbol *thunk_sym, *fn_sym;
struct obj_section *section;
- char *thunk_name, *fn_name;
+ const char *thunk_name, *fn_name;
real_stop_pc = gdbarch_skip_trampoline_code (gdbarch, frame, stop_pc);
if (real_stop_pc == 0)
@@ -804,7 +804,7 @@ gnuv3_pass_by_reference (struct type *ty
fieldelem++)
{
struct fn_field *fn = TYPE_FN_FIELDLIST1 (type, fieldnum);
- char *name = TYPE_FN_FIELDLIST_NAME (type, fieldnum);
+ const char *name = TYPE_FN_FIELDLIST_NAME (type, fieldnum);
struct type *fieldtype = TYPE_FN_FIELD_TYPE (fn, fieldelem);
/* If this function is marked as artificial, it is compiler-generated,
Index: i386-sol2-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-sol2-tdep.c,v
retrieving revision 1.33
diff -u -p -r1.33 i386-sol2-tdep.c
--- i386-sol2-tdep.c 2 Feb 2012 20:19:15 -0000 1.33
+++ i386-sol2-tdep.c 2 Feb 2012 21:55:41 -0000
@@ -79,8 +79,8 @@ i386_sol2_mcontext_addr (struct frame_in
/* SunPRO encodes the static variables. This is not related to C++
mangling, it is done for C too. */
-static char *
-i386_sol2_static_transform_name (char *name)
+static const char *
+i386_sol2_static_transform_name (const char *name)
{
char *p;
if (name[0] == '.')
Index: i386-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-tdep.c,v
retrieving revision 1.344
diff -u -p -r1.344 i386-tdep.c
--- i386-tdep.c 2 Feb 2012 20:19:15 -0000 1.344
+++ i386-tdep.c 2 Feb 2012 21:55:41 -0000
@@ -3273,7 +3273,7 @@ i386_pe_skip_trampoline_code (struct fra
read_memory_unsigned_integer (pc + 2, 4, byte_order);
struct minimal_symbol *indsym =
indirect ? lookup_minimal_symbol_by_pc (indirect) : 0;
- char *symname = indsym ? SYMBOL_LINKAGE_NAME (indsym) : 0;
+ const char *symname = indsym ? SYMBOL_LINKAGE_NAME (indsym) : 0;
if (symname)
{
Index: jv-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/jv-lang.c,v
retrieving revision 1.98
diff -u -p -r1.98 jv-lang.c
--- jv-lang.c 26 Jan 2012 04:20:36 -0000 1.98
+++ jv-lang.c 2 Feb 2012 21:55:41 -0000
@@ -45,8 +45,8 @@
extern void _initialize_java_language (void);
-static int java_demangled_signature_length (char *);
-static void java_demangled_signature_copy (char *, char *);
+static int java_demangled_signature_length (const char *);
+static void java_demangled_signature_copy (char *, const char *);
static struct symtab *get_java_class_symtab (struct gdbarch *gdbarch);
static char *get_java_utf8_name (struct obstack *obstack, struct value *name);
@@ -341,8 +341,8 @@ java_link_class_type (struct gdbarch *gd
struct type *type, struct value *clas)
{
struct value *temp;
- char *unqualified_name;
- char *name = TYPE_TAG_NAME (type);
+ const char *unqualified_name;
+ const char *name = TYPE_TAG_NAME (type);
int ninterfaces, nfields, nmethods;
int type_is_object = 0;
struct fn_field *fn_fields;
@@ -511,7 +511,7 @@ java_link_class_type (struct gdbarch *gd
methods = NULL;
for (i = 0; i < nmethods; i++)
{
- char *mname;
+ const char *mname;
int k;
if (methods == NULL)
@@ -617,7 +617,7 @@ is_object_type (struct type *type)
if (TYPE_CODE (type) == TYPE_CODE_PTR)
{
struct type *ttype = check_typedef (TYPE_TARGET_TYPE (type));
- char *name;
+ const char *name;
if (TYPE_CODE (ttype) != TYPE_CODE_STRUCT)
return 0;
while (TYPE_N_BASECLASSES (ttype) > 0)
@@ -667,7 +667,7 @@ java_primitive_type (struct gdbarch *gdb
struct type *
java_primitive_type_from_name (struct gdbarch *gdbarch,
- char *name, int namelen)
+ const char *name, int namelen)
{
const struct builtin_java_type *builtin = builtin_java_type (gdbarch);
@@ -742,7 +742,7 @@ java_primitive_type_name (int signature)
signature string SIGNATURE. */
static int
-java_demangled_signature_length (char *signature)
+java_demangled_signature_length (const char *signature)
{
int array = 0;
@@ -762,7 +762,7 @@ java_demangled_signature_length (char *s
RESULT. */
static void
-java_demangled_signature_copy (char *result, char *signature)
+java_demangled_signature_copy (char *result, const char *signature)
{
int array = 0;
char *ptr;
@@ -805,7 +805,7 @@ java_demangled_signature_copy (char *res
as a freshly allocated copy. */
char *
-java_demangle_type_signature (char *signature)
+java_demangle_type_signature (const char *signature)
{
int length = java_demangled_signature_length (signature);
char *result = xmalloc (length + 1);
@@ -905,7 +905,7 @@ evaluate_subexp_java (struct type *expec
{
int pc = *pos;
int i;
- char *name;
+ const char *name;
enum exp_opcode op = exp->elts[*pos].opcode;
struct value *arg1;
struct value *arg2;
Index: jv-lang.h
===================================================================
RCS file: /cvs/src/src/gdb/jv-lang.h,v
retrieving revision 1.20
diff -u -p -r1.20 jv-lang.h
--- jv-lang.h 4 Jan 2012 08:17:05 -0000 1.20
+++ jv-lang.h 2 Feb 2012 21:55:41 -0000
@@ -57,7 +57,7 @@ extern struct type *type_from_class (str
extern struct type *java_primitive_type (struct gdbarch *, int signature);
extern struct type *java_primitive_type_from_name (struct gdbarch *,
- char *, int);
+ const char *, int);
extern struct type *java_array_type (struct type *, int);
@@ -72,6 +72,6 @@ extern int is_object_type (struct type *
extern void java_print_type (struct type *, const char *,
struct ui_file *, int, int);
-extern char *java_demangle_type_signature (char *);
+extern char *java_demangle_type_signature (const char *);
#endif
Index: jv-typeprint.c
===================================================================
RCS file: /cvs/src/src/gdb/jv-typeprint.c,v
retrieving revision 1.25
diff -u -p -r1.25 jv-typeprint.c
--- jv-typeprint.c 4 Jan 2012 08:17:05 -0000 1.25
+++ jv-typeprint.c 2 Feb 2012 21:55:41 -0000
@@ -39,7 +39,7 @@ static void java_type_print_base (struct
static void
java_type_print_derivation_info (struct ui_file *stream, struct type *type)
{
- char *name;
+ const char *name;
int i;
int n_bases;
int prev;
@@ -208,8 +208,8 @@ java_type_print_base (struct type *type,
{
struct fn_field *f;
int j;
- char *method_name;
- char *name;
+ const char *method_name;
+ const char *name;
int is_constructor;
int n_overloads;
Index: jv-valprint.c
===================================================================
RCS file: /cvs/src/src/gdb/jv-valprint.c,v
retrieving revision 1.56
diff -u -p -r1.56 jv-valprint.c
--- jv-valprint.c 4 Jan 2012 08:17:05 -0000 1.56
+++ jv-valprint.c 2 Feb 2012 21:55:41 -0000
@@ -42,7 +42,7 @@ java_value_print (struct value *val, str
struct type *type;
CORE_ADDR address;
int i;
- char *name;
+ const char *name;
struct value_print_options opts;
type = value_type (val);
@@ -283,7 +283,7 @@ java_print_value_fields (struct type *ty
{
int boffset;
struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i));
- char *basename = TYPE_NAME (baseclass);
+ const char *basename = TYPE_NAME (baseclass);
const gdb_byte *base_valaddr;
if (BASETYPE_VIA_VIRTUAL (type, i))
@@ -325,7 +325,7 @@ java_print_value_fields (struct type *ty
/* If requested, skip printing of static fields. */
if (field_is_static (&TYPE_FIELD (type, i)))
{
- char *name = TYPE_FIELD_NAME (type, i);
+ const char *name = TYPE_FIELD_NAME (type, i);
if (!options->static_field_print)
continue;
Index: linespec.c
===================================================================
RCS file: /cvs/src/src/gdb/linespec.c,v
retrieving revision 1.147
diff -u -p -r1.147 linespec.c
--- linespec.c 1 Feb 2012 16:10:31 -0000 1.147
+++ linespec.c 2 Feb 2012 21:55:41 -0000
@@ -435,8 +435,7 @@ find_methods (struct type *t, const char
{
int i1 = 0;
int ibase;
- char *class_name = type_name_no_tag (t);
- char *canon;
+ const char *class_name = type_name_no_tag (t);
/* Ignore this class if it doesn't have a name. This is ugly, but
unless we figure out how to get the physname without the name of
@@ -456,7 +455,7 @@ find_methods (struct type *t, const char
method_counter >= 0;
--method_counter)
{
- char *method_name = TYPE_FN_FIELDLIST_NAME (t, method_counter);
+ const char *method_name = TYPE_FN_FIELDLIST_NAME (t, method_counter);
char dem_opname[64];
if (strncmp (method_name, "__", 2) == 0 ||
Index: m32c-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/m32c-tdep.c,v
retrieving revision 1.45
diff -u -p -r1.45 m32c-tdep.c
--- m32c-tdep.c 2 Feb 2012 20:19:15 -0000 1.45
+++ m32c-tdep.c 2 Feb 2012 21:55:41 -0000
@@ -2452,7 +2452,7 @@ m32c_m16c_address_to_pointer (struct gdb
if (target_code == TYPE_CODE_FUNC || target_code == TYPE_CODE_METHOD)
{
- char *func_name;
+ const char *func_name;
char *tramp_name;
struct minimal_symbol *tramp_msym;
@@ -2539,7 +2539,7 @@ m32c_m16c_pointer_to_address (struct gdb
if (ptr_msym)
{
- char *ptr_msym_name = SYMBOL_LINKAGE_NAME (ptr_msym);
+ const char *ptr_msym_name = SYMBOL_LINKAGE_NAME (ptr_msym);
int len = strlen (ptr_msym_name);
if (len > 4
Index: mdebugread.c
===================================================================
RCS file: /cvs/src/src/gdb/mdebugread.c,v
retrieving revision 1.128
diff -u -p -r1.128 mdebugread.c
--- mdebugread.c 19 Jan 2012 12:51:04 -0000 1.128
+++ mdebugread.c 2 Feb 2012 21:55:41 -0000
@@ -2359,7 +2359,7 @@ parse_partial_symbols (struct objfile *o
int past_first_source_file = 0;
/* List of current psymtab's include files. */
- char **psymtab_include_list;
+ const char **psymtab_include_list;
int includes_allocated;
int includes_used;
EXTR *extern_tab;
@@ -2389,8 +2389,8 @@ parse_partial_symbols (struct objfile *o
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 *));
next_symbol_text_func = mdebug_next_symbol_text;
dependencies_allocated = 30;
@@ -2754,7 +2754,7 @@ parse_partial_symbols (struct objfile *o
for (cur_sdx = 2; cur_sdx < fh->csym; cur_sdx++)
{
int type_code;
- char *namestring;
+ const char *namestring;
(*swap_sym_in) (cur_bfd,
(((char *) debug_info->external_sym)
@@ -3090,13 +3090,13 @@ parse_partial_symbols (struct objfile *o
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;
}
Index: minsyms.c
===================================================================
RCS file: /cvs/src/src/gdb/minsyms.c,v
retrieving revision 1.89
diff -u -p -r1.89 minsyms.c
--- minsyms.c 4 Jan 2012 08:17:06 -0000 1.89
+++ minsyms.c 2 Feb 2012 21:55:41 -0000
@@ -988,8 +988,8 @@ compare_minimal_symbols (const void *fn1
else
/* addrs are equal: sort by name */
{
- char *name1 = SYMBOL_LINKAGE_NAME (fn1);
- char *name2 = SYMBOL_LINKAGE_NAME (fn2);
+ const char *name1 = SYMBOL_LINKAGE_NAME (fn1);
+ const char *name2 = SYMBOL_LINKAGE_NAME (fn2);
if (name1 && name2) /* both have names */
return strcmp (name1, name2);
Index: objc-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/objc-lang.c,v
retrieving revision 1.101
diff -u -p -r1.101 objc-lang.c
--- objc-lang.c 26 Jan 2012 04:20:36 -0000 1.101
+++ objc-lang.c 2 Feb 2012 21:55:41 -0000
@@ -636,14 +636,14 @@ end_msglist(void)
}
/*
- * Function: specialcmp (char *a, char *b)
+ * Function: specialcmp (const char *a, const char *b)
*
* Special strcmp: treats ']' and ' ' as end-of-string.
* Used for qsorting lists of objc methods (either by class or selector).
*/
static int
-specialcmp (char *a, char *b)
+specialcmp (const char *a, const char *b)
{
while (*a && *a != ' ' && *a != ']' && *b && *b != ' ' && *b != ']')
{
@@ -668,7 +668,7 @@ specialcmp (char *a, char *b)
static int
compare_selectors (const void *a, const void *b)
{
- char *aname, *bname;
+ const char *aname, *bname;
aname = SYMBOL_PRINT_NAME (*(struct symbol **) a);
bname = SYMBOL_PRINT_NAME (*(struct symbol **) b);
@@ -697,7 +697,7 @@ selectors_info (char *regexp, int from_t
{
struct objfile *objfile;
struct minimal_symbol *msymbol;
- char *name;
+ const char *name;
char *val;
int matches = 0;
int maxlen = 0;
@@ -762,8 +762,8 @@ selectors_info (char *regexp, int from_t
}
if (regexp == NULL || re_exec(++name) != 0)
{
- char *mystart = name;
- char *myend = (char *) strchr (mystart, ']');
+ const char *mystart = name;
+ const char *myend = strchr (mystart, ']');
if (myend && (myend - mystart > maxlen))
maxlen = myend - mystart; /* Get longest selector. */
@@ -834,7 +834,7 @@ selectors_info (char *regexp, int from_t
static int
compare_classes (const void *a, const void *b)
{
- char *aname, *bname;
+ const char *aname, *bname;
aname = SYMBOL_PRINT_NAME (*(struct symbol **) a);
bname = SYMBOL_PRINT_NAME (*(struct symbol **) b);
@@ -859,7 +859,7 @@ classes_info (char *regexp, int from_tty
{
struct objfile *objfile;
struct minimal_symbol *msymbol;
- char *name;
+ const char *name;
char *val;
int matches = 0;
int maxlen = 0;
@@ -901,8 +901,8 @@ classes_info (char *regexp, int from_tty
if (regexp == NULL || re_exec(name+2) != 0)
{
/* Compute length of classname part. */
- char *mystart = name + 2;
- char *myend = (char *) strchr(mystart, ' ');
+ const char *mystart = name + 2;
+ const char *myend = strchr (mystart, ' ');
if (myend && (myend - mystart > maxlen))
maxlen = myend - mystart;
@@ -1119,7 +1119,7 @@ find_methods (char type, const char *cla
{
struct objfile *objfile = NULL;
- char *symname = NULL;
+ const char *symname = NULL;
char ntype = '\0';
char *nclass = NULL;
Index: p-exp.y
===================================================================
RCS file: /cvs/src/src/gdb/p-exp.y,v
retrieving revision 1.62
diff -u -p -r1.62 p-exp.y
--- p-exp.y 16 Jan 2012 21:03:36 -0000 1.62
+++ p-exp.y 2 Feb 2012 21:55:41 -0000
@@ -338,7 +338,7 @@ exp : field_exp COMPLETE
exp : exp '['
/* We need to save the current_type value. */
- { char *arrayname;
+ { const char *arrayname;
int arrayfieldindex;
arrayfieldindex = is_pascal_string_type (
current_type, NULL, NULL,
Index: p-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/p-lang.c,v
retrieving revision 1.63
diff -u -p -r1.63 p-lang.c
--- p-lang.c 26 Jan 2012 04:20:36 -0000 1.63
+++ p-lang.c 2 Feb 2012 21:55:41 -0000
@@ -99,7 +99,7 @@ int
is_pascal_string_type (struct type *type,int *length_pos,
int *length_size, int *string_pos,
struct type **char_type,
- char **arrayname)
+ const char **arrayname)
{
if (type != NULL && TYPE_CODE (type) == TYPE_CODE_STRUCT)
{
Index: p-lang.h
===================================================================
RCS file: /cvs/src/src/gdb/p-lang.h,v
retrieving revision 1.28
diff -u -p -r1.28 p-lang.h
--- p-lang.h 4 Jan 2012 08:17:09 -0000 1.28
+++ p-lang.h 2 Feb 2012 21:55:41 -0000
@@ -50,7 +50,7 @@ extern void pascal_type_print_method_arg
extern int
is_pascal_string_type (struct type *, int *, int *, int *,
- struct type **, char **);
+ struct type **, const char **);
extern void pascal_printchar (int, struct type *, struct ui_file *);
Index: p-typeprint.c
===================================================================
RCS file: /cvs/src/src/gdb/p-typeprint.c,v
retrieving revision 1.43
diff -u -p -r1.43 p-typeprint.c
--- p-typeprint.c 4 Jan 2012 08:17:09 -0000 1.43
+++ p-typeprint.c 2 Feb 2012 21:55:41 -0000
@@ -131,7 +131,7 @@ pascal_print_typedef (struct type *type,
static void
pascal_type_print_derivation_info (struct ui_file *stream, struct type *type)
{
- char *name;
+ const char *name;
int i;
for (i = 0; i < TYPE_N_BASECLASSES (type); i++)
@@ -630,7 +630,7 @@ pascal_type_print_base (struct type *typ
{
struct fn_field *f = TYPE_FN_FIELDLIST1 (type, i);
int j, len2 = TYPE_FN_FIELDLIST_LENGTH (type, i);
- char *method_name = TYPE_FN_FIELDLIST_NAME (type, i);
+ const char *method_name = TYPE_FN_FIELDLIST_NAME (type, i);
/* this is GNU C++ specific
how can we know constructor/destructor?
Index: p-valprint.c
===================================================================
RCS file: /cvs/src/src/gdb/p-valprint.c,v
retrieving revision 1.92
diff -u -p -r1.92 p-valprint.c
--- p-valprint.c 4 Jan 2012 08:17:09 -0000 1.92
+++ p-valprint.c 2 Feb 2012 21:55:41 -0000
@@ -649,7 +649,7 @@ const char pascal_vtbl_ptr_name[] =
int
pascal_object_is_vtbl_ptr_type (struct type *type)
{
- char *typename = type_name_no_tag (type);
+ const char *typename = type_name_no_tag (type);
return (typename != NULL
&& strcmp (typename, pascal_vtbl_ptr_name) == 0);
@@ -912,7 +912,7 @@ pascal_object_print_value (struct type *
{
int boffset = 0;
struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i));
- char *basename = type_name_no_tag (baseclass);
+ const char *basename = type_name_no_tag (baseclass);
const gdb_byte *base_valaddr = NULL;
int thisoffset;
volatile struct gdb_exception ex;
Index: printcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/printcmd.c,v
retrieving revision 1.201
diff -u -p -r1.201 printcmd.c
--- printcmd.c 4 Jan 2012 08:17:09 -0000 1.201
+++ printcmd.c 2 Feb 2012 21:55:41 -0000
@@ -638,7 +638,7 @@ build_address_symbolic (struct gdbarch *
struct symbol *symbol;
CORE_ADDR name_location = 0;
struct obj_section *section = NULL;
- char *name_temp = "";
+ const char *name_temp = "";
/* Let's say it is mapped (not unmapped). */
*unmapped = 0;
Index: solib-frv.c
===================================================================
RCS file: /cvs/src/src/gdb/solib-frv.c,v
retrieving revision 1.43
diff -u -p -r1.43 solib-frv.c
--- solib-frv.c 4 Jan 2012 08:17:11 -0000 1.43
+++ solib-frv.c 2 Feb 2012 21:55:41 -0000
@@ -961,7 +961,7 @@ frv_fdpic_find_global_pointer (CORE_ADDR
/* Forward declarations for frv_fdpic_find_canonical_descriptor(). */
static CORE_ADDR find_canonical_descriptor_in_load_object
- (CORE_ADDR, CORE_ADDR, char *, bfd *, struct lm_info *);
+ (CORE_ADDR, CORE_ADDR, const char *, bfd *, struct lm_info *);
/* Given a function entry point, attempt to find the canonical descriptor
associated with that entry point. Return 0 if no canonical descriptor
@@ -970,7 +970,7 @@ static CORE_ADDR find_canonical_descript
CORE_ADDR
frv_fdpic_find_canonical_descriptor (CORE_ADDR entry_point)
{
- char *name;
+ const char *name;
CORE_ADDR addr;
CORE_ADDR got_value;
struct int_elf32_fdpic_loadmap *ldm = 0;
@@ -1019,7 +1019,7 @@ frv_fdpic_find_canonical_descriptor (COR
static CORE_ADDR
find_canonical_descriptor_in_load_object
- (CORE_ADDR entry_point, CORE_ADDR got_value, char *name, bfd *abfd,
+ (CORE_ADDR entry_point, CORE_ADDR got_value, const char *name, bfd *abfd,
struct lm_info *lm)
{
enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
Index: sparc-sol2-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sparc-sol2-tdep.c,v
retrieving revision 1.28
diff -u -p -r1.28 sparc-sol2-tdep.c
--- sparc-sol2-tdep.c 2 Feb 2012 20:19:16 -0000 1.28
+++ sparc-sol2-tdep.c 2 Feb 2012 21:55:41 -0000
@@ -173,8 +173,8 @@ static const struct frame_unwind sparc32
/* Unglobalize NAME. */
-char *
-sparc_sol2_static_transform_name (char *name)
+const const char *
+sparc_sol2_static_transform_name (const char *name)
{
/* The Sun compilers (Sun ONE Studio, Forte Developer, Sun WorkShop,
SunPRO) convert file static variables into global values, a
Index: sparc-tdep.h
===================================================================
RCS file: /cvs/src/src/gdb/sparc-tdep.h,v
retrieving revision 1.30
diff -u -p -r1.30 sparc-tdep.h
--- sparc-tdep.h 2 Feb 2012 20:19:16 -0000 1.30
+++ sparc-tdep.h 2 Feb 2012 21:55:41 -0000
@@ -217,7 +217,7 @@ extern const struct sparc_gregset sparc3
extern int sparc_sol2_pc_in_sigtramp (CORE_ADDR pc, const char *name);
-extern char *sparc_sol2_static_transform_name (char *name);
+extern const char *sparc_sol2_static_transform_name (const char *name);
extern void sparc32_sol2_init_abi (struct gdbarch_info info,
struct gdbarch *gdbarch);
Index: stabsread.h
===================================================================
RCS file: /cvs/src/src/gdb/stabsread.h,v
retrieving revision 1.28
diff -u -p -r1.28 stabsread.h
--- stabsread.h 4 Jan 2012 08:17:12 -0000 1.28
+++ stabsread.h 2 Feb 2012 21:55:41 -0000
@@ -162,7 +162,7 @@ struct stab_section_list
they are only used by some stabs readers. */
extern struct partial_symtab *end_psymtab (struct partial_symtab *pst,
- char **include_list,
+ const char **include_list,
int num_includes,
int capping_symbol_offset,
CORE_ADDR capping_text,
Index: stack.c
===================================================================
RCS file: /cvs/src/src/gdb/stack.c,v
retrieving revision 1.246
diff -u -p -r1.246 stack.c
--- stack.c 28 Jan 2012 18:08:20 -0000 1.246
+++ stack.c 2 Feb 2012 21:55:41 -0000
@@ -999,7 +999,7 @@ get_last_displayed_sal (struct symtab_an
corresponding to FRAME. */
void
-find_frame_funname (struct frame_info *frame, char **funname,
+find_frame_funname (struct frame_info *frame, const char **funname,
enum language *funlang, struct symbol **funcp)
{
struct symbol *func;
@@ -1095,7 +1095,7 @@ print_frame (struct frame_info *frame, i
{
struct gdbarch *gdbarch = get_frame_arch (frame);
struct ui_out *uiout = current_uiout;
- char *funname = NULL;
+ const char *funname = NULL;
enum language funlang = language_unknown;
struct ui_stream *stb;
struct cleanup *old_chain, *list_chain;
@@ -1363,7 +1363,7 @@ frame_info (char *addr_exp, int from_tty
struct symtab *s;
struct frame_info *calling_frame_info;
int numregs;
- char *funname = 0;
+ const char *funname = 0;
enum language funlang = language_unknown;
const char *pc_regname;
int selected_frame_p;
Index: stack.h
===================================================================
RCS file: /cvs/src/src/gdb/stack.h,v
retrieving revision 1.14
diff -u -p -r1.14 stack.h
--- stack.h 4 Jan 2012 08:17:13 -0000 1.14
+++ stack.h 2 Feb 2012 21:55:41 -0000
@@ -22,7 +22,7 @@
void select_frame_command (char *level_exp, int from_tty);
-void find_frame_funname (struct frame_info *frame, char **funname,
+void find_frame_funname (struct frame_info *frame, const char **funname,
enum language *funlang, struct symbol **funcp);
typedef void (*iterate_over_block_arg_local_vars_cb) (const char *print_name,
Index: symtab.c
===================================================================
RCS file: /cvs/src/src/gdb/symtab.c,v
retrieving revision 1.296
diff -u -p -r1.296 symtab.c
--- symtab.c 2 Feb 2012 14:58:31 -0000 1.296
+++ symtab.c 2 Feb 2012 21:55:41 -0000
@@ -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
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 genera
/* 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_
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_
/* 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 genera
/* 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 gene
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,
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);
Index: symtab.h
===================================================================
RCS file: /cvs/src/src/gdb/symtab.h,v
retrieving revision 1.202
diff -u -p -r1.202 symtab.h
--- symtab.h 2 Feb 2012 20:19:16 -0000 1.202
+++ symtab.h 2 Feb 2012 21:55:42 -0000
@@ -81,7 +81,7 @@ struct language_defn;
struct cplus_specific
{
- char *demangled_name;
+ const char *demangled_name;
};
/* Define a structure for the information that is common to all symbol types,
@@ -99,7 +99,7 @@ struct general_symbol_info
the mangled name and demangled name, this is the mangled
name. */
- char *name;
+ const char *name;
/* Value of the symbol. Which member of this union to use, and what
it means, depends on what kind of symbol this is and its
@@ -135,7 +135,7 @@ struct general_symbol_info
currently used by Ada, Java, and Objective C. */
struct mangled_lang
{
- char *demangled_name;
+ const char *demangled_name;
}
mangled_lang;
@@ -166,7 +166,8 @@ struct general_symbol_info
extern void symbol_set_demangled_name (struct general_symbol_info *, char *,
struct objfile *);
-extern char *symbol_get_demangled_name (const struct general_symbol_info *);
+extern const char *symbol_get_demangled_name
+ (const struct general_symbol_info *);
extern CORE_ADDR symbol_overlayed_address (CORE_ADDR, struct obj_section *);
@@ -225,7 +226,8 @@ extern void symbol_set_names (struct gen
#define SYMBOL_NATURAL_NAME(symbol) \
(symbol_natural_name (&(symbol)->ginfo))
-extern char *symbol_natural_name (const struct general_symbol_info *symbol);
+extern const 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
@@ -238,7 +240,8 @@ extern char *symbol_natural_name (const
that symbol. If no demangled name exists, return NULL. */
#define SYMBOL_DEMANGLED_NAME(symbol) \
(symbol_demangled_name (&(symbol)->ginfo))
-extern char *symbol_demangled_name (const struct general_symbol_info *symbol);
+extern const char *symbol_demangled_name
+ (const struct general_symbol_info *symbol);
/* Macro that returns a version of the name of a symbol that is
suitable for output. In C++ this is the "demangled" form of the
@@ -261,7 +264,7 @@ extern int demangle;
returns the same value (same pointer) as SYMBOL_LINKAGE_NAME. */
#define SYMBOL_SEARCH_NAME(symbol) \
(symbol_search_name (&(symbol)->ginfo))
-extern char *symbol_search_name (const struct general_symbol_info *);
+extern const char *symbol_search_name (const struct general_symbol_info *);
/* Return non-zero if NAME matches the "search" name of SYMBOL.
Whitespace and trailing parentheses are ignored.
Index: tracepoint.c
===================================================================
RCS file: /cvs/src/src/gdb/tracepoint.c,v
retrieving revision 1.244
diff -u -p -r1.244 tracepoint.c
--- tracepoint.c 4 Jan 2012 08:27:57 -0000 1.244
+++ tracepoint.c 2 Feb 2012 21:55:42 -0000
@@ -2577,7 +2577,8 @@ scope_info (char *args, int from_tty)
struct symbol *sym;
struct minimal_symbol *msym;
struct block *block;
- char *symname, *save_args = args;
+ const char *symname;
+ char *save_args = args;
struct dict_iterator iter;
int j, count = 0;
struct gdbarch *gdbarch;
Index: typeprint.c
===================================================================
RCS file: /cvs/src/src/gdb/typeprint.c,v
retrieving revision 1.43
diff -u -p -r1.43 typeprint.c
--- typeprint.c 4 Jan 2012 08:27:57 -0000 1.43
+++ typeprint.c 2 Feb 2012 21:55:42 -0000
@@ -73,7 +73,7 @@ default_print_typedef (struct type *type
If SHOW is negative, we never show the details of elements' types. */
void
-type_print (struct type *type, char *varstring, struct ui_file *stream,
+type_print (struct type *type, const char *varstring, struct ui_file *stream,
int show)
{
LA_PRINT_TYPE (type, varstring, stream, show, 0);
Index: utils.c
===================================================================
RCS file: /cvs/src/src/gdb/utils.c,v
retrieving revision 1.273
diff -u -p -r1.273 utils.c
--- utils.c 28 Jan 2012 18:08:21 -0000 1.273
+++ utils.c 2 Feb 2012 21:55:42 -0000
@@ -2589,7 +2589,7 @@ print_spaces_filtered (int n, struct ui_
demangling is off, the name is printed in its "raw" form. */
void
-fprintf_symbol_filtered (struct ui_file *stream, char *name,
+fprintf_symbol_filtered (struct ui_file *stream, const char *name,
enum language lang, int arg_mode)
{
char *demangled;
Index: valarith.c
===================================================================
RCS file: /cvs/src/src/gdb/valarith.c,v
retrieving revision 1.101
diff -u -p -r1.101 valarith.c
--- valarith.c 4 Jan 2012 08:27:57 -0000 1.101
+++ valarith.c 2 Feb 2012 21:55:42 -0000
@@ -64,7 +64,7 @@ find_size_for_pointer_math (struct type
sz = 1;
else
{
- char *name;
+ const char *name;
name = TYPE_NAME (ptr_target);
if (name == NULL)
Index: valops.c
===================================================================
RCS file: /cvs/src/src/gdb/valops.c,v
retrieving revision 1.291
diff -u -p -r1.291 valops.c
--- valops.c 4 Jan 2012 08:27:57 -0000 1.291
+++ valops.c 2 Feb 2012 21:55:42 -0000
@@ -2005,7 +2005,7 @@ search_struct_field (const char *name, s
if (!looking_for_baseclass)
for (i = TYPE_NFIELDS (type) - 1; i >= nbases; i--)
{
- char *t_field_name = TYPE_FIELD_NAME (type, i);
+ const char *t_field_name = TYPE_FIELD_NAME (type, i);
if (t_field_name && (strcmp_iw (t_field_name, name) == 0))
{
@@ -2163,7 +2163,7 @@ search_struct_method (const char *name,
CHECK_TYPEDEF (type);
for (i = TYPE_NFN_FIELDS (type) - 1; i >= 0; i--)
{
- char *t_field_name = TYPE_FN_FIELDLIST_NAME (type, i);
+ const char *t_field_name = TYPE_FN_FIELDLIST_NAME (type, i);
/* FIXME! May need to check for ARM demangling here. */
if (strncmp (t_field_name, "__", 2) == 0 ||
@@ -2407,7 +2407,7 @@ find_method_list (struct value **argp, c
for (i = TYPE_NFN_FIELDS (type) - 1; i >= 0; i--)
{
/* pai: FIXME What about operators and type conversions? */
- char *fn_field_name = TYPE_FN_FIELDLIST_NAME (type, i);
+ const char *fn_field_name = TYPE_FN_FIELDLIST_NAME (type, i);
if (fn_field_name && (strcmp_iw (fn_field_name, method) == 0))
{
@@ -3154,7 +3154,7 @@ check_field (struct type *type, const ch
for (i = TYPE_NFIELDS (type) - 1; i >= TYPE_N_BASECLASSES (type); i--)
{
- char *t_field_name = TYPE_FIELD_NAME (type, i);
+ const char *t_field_name = TYPE_FIELD_NAME (type, i);
if (t_field_name && (strcmp_iw (t_field_name, name) == 0))
return 1;
@@ -3280,7 +3280,7 @@ value_struct_elt_for_reference (struct t
for (i = TYPE_NFIELDS (t) - 1; i >= TYPE_N_BASECLASSES (t); i--)
{
- char *t_field_name = TYPE_FIELD_NAME (t, i);
+ const char *t_field_name = TYPE_FIELD_NAME (t, i);
if (t_field_name && strcmp (t_field_name, name) == 0)
{
@@ -3317,7 +3317,7 @@ value_struct_elt_for_reference (struct t
for (i = TYPE_NFN_FIELDS (t) - 1; i >= 0; --i)
{
- char *t_field_name = TYPE_FN_FIELDLIST_NAME (t, i);
+ const char *t_field_name = TYPE_FN_FIELDLIST_NAME (t, i);
char dem_opname[64];
if (strncmp (t_field_name, "__", 2) == 0
Index: value.h
===================================================================
RCS file: /cvs/src/src/gdb/value.h,v
retrieving revision 1.192
diff -u -p -r1.192 value.h
--- value.h 4 Jan 2012 08:27:58 -0000 1.192
+++ value.h 2 Feb 2012 21:55:42 -0000
@@ -777,7 +777,7 @@ extern int record_latest_value (struct v
extern void modify_field (struct type *type, gdb_byte *addr,
LONGEST fieldval, int bitpos, int bitsize);
-extern void type_print (struct type *type, char *varstring,
+extern void type_print (struct type *type, const char *varstring,
struct ui_file *stream, int show);
extern char *type_to_string (struct type *type);
Index: varobj.c
===================================================================
RCS file: /cvs/src/src/gdb/varobj.c,v
retrieving revision 1.188
diff -u -p -r1.188 varobj.c
--- varobj.c 12 Jan 2012 22:51:10 -0000 1.188
+++ varobj.c 2 Feb 2012 21:55:42 -0000
@@ -3086,7 +3086,7 @@ c_describe_child (struct varobj *parent,
case TYPE_CODE_STRUCT:
case TYPE_CODE_UNION:
{
- char *field_name;
+ const char *field_name;
/* If the type is anonymous and the field has no name,
set an appropriate name. */
@@ -3515,7 +3515,7 @@ cplus_describe_child (struct varobj *par
enum accessibility acc = public_field;
int vptr_fieldno;
struct type *basetype = NULL;
- char *field_name;
+ const char *field_name;
vptr_fieldno = get_vptr_fieldno (type, &basetype);
if (strcmp (parent->name, "private") == 0)
Index: xcoffread.c
===================================================================
RCS file: /cvs/src/src/gdb/xcoffread.c,v
retrieving revision 1.91
diff -u -p -r1.91 xcoffread.c
--- xcoffread.c 4 Jan 2012 08:27:58 -0000 1.91
+++ xcoffread.c 2 Feb 2012 21:55:42 -0000
@@ -882,7 +882,7 @@ enter_line_range (struct subfile *subfil
#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
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 offs
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_star
(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 *obj
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_
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
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 *objfi
{
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 *objfi
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 *objfi
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 *objfi
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 *objfi
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;
}
Index: python/py-frame.c
===================================================================
RCS file: /cvs/src/src/gdb/python/py-frame.c,v
retrieving revision 1.24
diff -u -p -r1.24 py-frame.c
--- python/py-frame.c 4 Jan 2012 08:17:25 -0000 1.24
+++ python/py-frame.c 2 Feb 2012 21:55:42 -0000
@@ -124,7 +124,7 @@ static PyObject *
frapy_name (PyObject *self, PyObject *args)
{
struct frame_info *frame;
- char *name;
+ const char *name;
enum language lang;
PyObject *result;
volatile struct gdb_exception except;
Index: python/py-type.c
===================================================================
RCS file: /cvs/src/src/gdb/python/py-type.c,v
retrieving revision 1.34
diff -u -p -r1.34 py-type.c
--- python/py-type.c 4 Jan 2012 08:17:25 -0000 1.34
+++ python/py-type.c 2 Feb 2012 21:55:42 -0000
@@ -1271,7 +1271,7 @@ typy_getitem (PyObject *self, PyObject *
for (i = 0; i < TYPE_NFIELDS (type); i++)
{
- char *t_field_name = TYPE_FIELD_NAME (type, i);
+ const char *t_field_name = TYPE_FIELD_NAME (type, i);
if (t_field_name && (strcmp_iw (t_field_name, field) == 0))
{
@@ -1332,7 +1332,7 @@ typy_has_key (PyObject *self, PyObject *
for (i = 0; i < TYPE_NFIELDS (type); i++)
{
- char *t_field_name = TYPE_FIELD_NAME (type, i);
+ const char *t_field_name = TYPE_FIELD_NAME (type, i);
if (t_field_name && (strcmp_iw (t_field_name, field) == 0))
Py_RETURN_TRUE;