* symtab.c (gdb_mangle_name): Constify.
* stabsread.c (update_method_name_from_physname): Make 'physname'
argument const.
* p-typeprint.c (pascal_type_print_method_args): Make arguments
const. Use explicit fputc_filtered loop.
(pascal_type_print_base): Constify.
* p-lang.h (pascal_type_print_method_args): Update.
* linespec.c (add_matching_methods): Constify.
(add_constructors): Likewise.
* jv-typeprint.c (java_type_print_base): Constify.
* gdbtypes.h (struct cplus_struct_type)
<fn_fieldlist.fn_field.physname>: Now const.
* dwarf2read.c (compute_delayed_physnames): Constify.
(dwarf2_add_member_fn): Likewise.
* c-typeprint.c (c_type_print_base): Constify. Use cleanups.
+2011-05-18 Tom Tromey <tromey@redhat.com>
+
+ * value.c (value_fn_field): Constify.
+ * symtab.c (gdb_mangle_name): Constify.
+ * stabsread.c (update_method_name_from_physname): Make 'physname'
+ argument const.
+ * p-typeprint.c (pascal_type_print_method_args): Make arguments
+ const. Use explicit fputc_filtered loop.
+ (pascal_type_print_base): Constify.
+ * p-lang.h (pascal_type_print_method_args): Update.
+ * linespec.c (add_matching_methods): Constify.
+ (add_constructors): Likewise.
+ * jv-typeprint.c (java_type_print_base): Constify.
+ * gdbtypes.h (struct cplus_struct_type)
+ <fn_fieldlist.fn_field.physname>: Now const.
+ * dwarf2read.c (compute_delayed_physnames): Constify.
+ (dwarf2_add_member_fn): Likewise.
+ * c-typeprint.c (c_type_print_base): Constify. Use cleanups.
+
2011-05-18 Pedro Alves <pedro@codesourcery.com>
* infrun.c (resume): Mention which is the current thread, and its
int i;
int len, real_len;
int lastval;
- char *mangled_name;
- char *demangled_name;
- char *demangled_no_static;
enum
{
s_none, s_public, s_private, s_protected
for (j = 0; j < len2; j++)
{
- char *physname = TYPE_FN_FIELD_PHYSNAME (f, j);
+ const char *mangled_name;
+ char *demangled_name;
+ struct cleanup *inner_cleanup;
+ const char *physname = TYPE_FN_FIELD_PHYSNAME (f, j);
int is_full_physname_constructor =
is_constructor_name (physname)
|| is_destructor_name (physname)
if (TYPE_FN_FIELD_ARTIFICIAL (f, j))
continue;
+ inner_cleanup = make_cleanup (null_cleanup, NULL);
+
QUIT;
if (TYPE_FN_FIELD_PROTECTED (f, j))
{
fputs_filtered (" ", stream);
}
if (TYPE_FN_FIELD_STUB (f, j))
- /* Build something we can demangle. */
- mangled_name = gdb_mangle_name (type, i, j);
+ {
+ char *tem;
+
+ /* Build something we can demangle. */
+ tem = gdb_mangle_name (type, i, j);
+ make_cleanup (xfree, tem);
+ mangled_name = tem;
+ }
else
mangled_name = TYPE_FN_FIELD_PHYSNAME (f, j);
if (p != NULL)
{
int length = p - demangled_no_class;
+ char *demangled_no_static;
demangled_no_static
= (char *) xmalloc (length + 1);
xfree (demangled_name);
}
- if (TYPE_FN_FIELD_STUB (f, j))
- xfree (mangled_name);
+ do_cleanups (inner_cleanup);
fprintf_filtered (stream, ";\n");
}
struct delayed_method_info *mi;
for (i = 0; VEC_iterate (delayed_method_info, cu->method_list, i, mi) ; ++i)
{
- char *physname;
+ const char *physname;
struct fn_fieldlist *fn_flp
= &TYPE_FN_FIELDLIST (mi->type, mi->fnfield_index);
- physname = (char *) dwarf2_physname ((char *) mi->name, mi->die, cu);
+ physname = dwarf2_physname ((char *) mi->name, mi->die, cu);
fn_flp->fn_fields[mi->index].physname = physname ? physname : "";
}
}
}
else
{
- char *physname = (char *) dwarf2_physname (fieldname, die, cu);
+ const char *physname = dwarf2_physname (fieldname, die, cu);
fnp->physname = physname ? physname : "";
}
arguments. See gdb_mangle_name for the conversion from this
format to the one used if is_stub is clear. */
- char *physname;
+ const char *physname;
/* The function type for the method.
(This comment used to say "The return value of the method",
for (j = 0; j < n_overloads; j++)
{
- char *real_physname, *physname, *p;
+ const char *real_physname;
+ char *physname, *p;
int is_full_physname_constructor;
real_physname = TYPE_FN_FIELD_PHYSNAME (f, j);
--field_counter)
{
struct fn_field *f;
- char *phys_name;
+ const char *phys_name;
f = TYPE_FN_FIELDLIST1 (t, method_counter);
if (TYPE_FN_FIELD_STUB (f, field_counter))
{
- char *tmp_name;
+ char *tmp_name, *tmp2;
tmp_name = gdb_mangle_name (t,
method_counter,
field_counter);
- phys_name = alloca (strlen (tmp_name) + 1);
- strcpy (phys_name, tmp_name);
+ tmp2 = alloca (strlen (tmp_name) + 1);
+ strcpy (tmp2, tmp_name);
xfree (tmp_name);
+ phys_name = tmp2;
}
else
phys_name = TYPE_FN_FIELD_PHYSNAME (f, field_counter);
--field_counter)
{
struct fn_field *f;
- char *phys_name;
+ const char *phys_name;
f = TYPE_FN_FIELDLIST1 (t, method_counter);
extern int pascal_value_print (struct value *, struct ui_file *,
const struct value_print_options *);
-extern void pascal_type_print_method_args (char *, char *,
+extern void pascal_type_print_method_args (const char *, const char *,
struct ui_file *);
/* These are in p-lang.c: */
/* Print the Pascal method arguments ARGS to the file STREAM. */
void
-pascal_type_print_method_args (char *physname, char *methodname,
+pascal_type_print_method_args (const char *physname, const char *methodname,
struct ui_file *stream)
{
int is_constructor = (strncmp (physname, "__ct__", 6) == 0);
while (isdigit (physname[0]))
{
int len = 0;
- int i;
- char storec;
+ int i, j;
char *argname;
while (isdigit (physname[len]))
}
i = strtol (physname, &argname, 0);
physname += len;
- storec = physname[i];
- physname[i] = 0;
+
+ for (j = 0; j < i; ++j)
+ fputc_filtered (physname[i], stream);
fputs_filtered (physname, stream);
- physname[i] = storec;
+
physname += i;
if (physname[0] != 0)
{
It might work for GNU pascal. */
for (j = 0; j < len2; j++)
{
- char *physname = TYPE_FN_FIELD_PHYSNAME (f, j);
+ const char *physname = TYPE_FN_FIELD_PHYSNAME (f, j);
int is_constructor = (strncmp (physname, "__ct__", 6) == 0);
int is_destructor = (strncmp (physname, "__dt__", 6) == 0);
/* Replace *OLD_NAME with the method name portion of PHYSNAME. */
static void
-update_method_name_from_physname (char **old_name, char *physname)
+update_method_name_from_physname (char **old_name, const char *physname)
{
char *method_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);
- char *physname = TYPE_FN_FIELD_PHYSNAME (f, signature_id);
+ const char *physname = TYPE_FN_FIELD_PHYSNAME (f, signature_id);
char *newname = type_name_no_tag (type);
/* Does the form of physname indicate that it is the full mangled name
{
struct value *v;
struct type *ftype = TYPE_FN_FIELD_TYPE (f, j);
- char *physname = TYPE_FN_FIELD_PHYSNAME (f, j);
+ const char *physname = TYPE_FN_FIELD_PHYSNAME (f, j);
struct symbol *sym;
struct minimal_symbol *msym;