* gdbarch.c, gdbarch.h: Regenerate.
* dbxread.c (read_dbx_symtab): Use gdbarch_static_transform_name
instead of STATIC_TRANSFORM_NAME.
* mdebugread.c (parse_partial_symbols): Likewise.
* stabsread.c (define_symbol): Likewise.
* xcoffread.c (scan_xcoff_symtab): Likewise.
* config/i368/tm-i386sol2.h (STATIC_TRANSFORM_NAME): Remove.
(IS_STATIC_TRANSFORM_NAME): Remove.
* i386-tdep.c (sunpro_static_transform_name): Remove, move to ...
* i386-sol2-tdep.c (i386_sol2_static_transform_name): ... here.
(i386_sol2_init_abi): Install it.
* config/sparc/tm-sol2.h (STATIC_TRANSFORM_NAME): Remove.
(IS_STATIC_TRANSFORM_NAME): Remove.
* sparc-tdep.c (sparc_stabs_unglobalize_name): Remove, move to ...
* sparc-sol2-tdep.c (sparc_sol2_static_transform_name): ... here.
(sparc32_sol2_init_abi): Install it.
* sparc64-sol2-tdep.c (sparc64_sol2_init_abi): Likewise.
* sparc-tdep.h (sparc_sol2_static_transform_name): Add prototype.
+2007-10-19 Ulrich Weigand <uweigand@de.ibm.com>
+
+ * gdbarch.sh (static_transform_name): New gdbarch callback.
+ * gdbarch.c, gdbarch.h: Regenerate.
+ * dbxread.c (read_dbx_symtab): Use gdbarch_static_transform_name
+ instead of STATIC_TRANSFORM_NAME.
+ * mdebugread.c (parse_partial_symbols): Likewise.
+ * stabsread.c (define_symbol): Likewise.
+ * xcoffread.c (scan_xcoff_symtab): Likewise.
+
+ * config/i368/tm-i386sol2.h (STATIC_TRANSFORM_NAME): Remove.
+ (IS_STATIC_TRANSFORM_NAME): Remove.
+ * i386-tdep.c (sunpro_static_transform_name): Remove, move to ...
+ * i386-sol2-tdep.c (i386_sol2_static_transform_name): ... here.
+ (i386_sol2_init_abi): Install it.
+
+ * config/sparc/tm-sol2.h (STATIC_TRANSFORM_NAME): Remove.
+ (IS_STATIC_TRANSFORM_NAME): Remove.
+ * sparc-tdep.c (sparc_stabs_unglobalize_name): Remove, move to ...
+ * sparc-sol2-tdep.c (sparc_sol2_static_transform_name): ... here.
+ (sparc32_sol2_init_abi): Install it.
+ * sparc64-sol2-tdep.c (sparc64_sol2_init_abi): Likewise.
+ * sparc-tdep.h (sparc_sol2_static_transform_name): Add prototype.
+
2007-10-18 Daniel Jacobowitz <dan@codesourcery.com>
* mips-tdep.c (mips_xfer_register): Take a gdbarch argument.
and for SunPRO 3.0, N_FUN symbols too. */
#define SOFUN_ADDRESS_MAYBE_MISSING
-extern char *sunpro_static_transform_name (char *);
-#define STATIC_TRANSFORM_NAME(x) sunpro_static_transform_name (x)
-#define IS_STATIC_TRANSFORM_NAME(name) ((name)[0] == '.')
-
#endif /* tm-i386sol2.h */
too. */
#define SOFUN_ADDRESS_MAYBE_MISSING
-/* The Sun compilers also do "globalization"; see the comment in
- sparc-tdep.c for more information. */
-extern char *sparc_stabs_unglobalize_name (char *name);
-#define STATIC_TRANSFORM_NAME(name) \
- sparc_stabs_unglobalize_name (name)
-#define IS_STATIC_TRANSFORM_NAME(name) \
- ((name) != sparc_stabs_unglobalize_name (name))
-
#endif /* tm-sol2.h */
{
case 'S':
nlist.n_value += ANOFFSET (objfile->section_offsets, data_sect_index);
-#ifdef STATIC_TRANSFORM_NAME
- namestring = STATIC_TRANSFORM_NAME (namestring);
-#endif
+
+ if (gdbarch_static_transform_name_p (current_gdbarch))
+ namestring = gdbarch_static_transform_name
+ (current_gdbarch, namestring);
+
add_psymbol_to_list (namestring, p - namestring,
VAR_DOMAIN, LOC_STATIC,
&objfile->static_psymbols,
gdbarch_skip_permanent_breakpoint_ftype *skip_permanent_breakpoint;
gdbarch_overlay_update_ftype *overlay_update;
gdbarch_core_read_description_ftype *core_read_description;
+ gdbarch_static_transform_name_ftype *static_transform_name;
};
0, /* skip_permanent_breakpoint */
0, /* overlay_update */
0, /* core_read_description */
+ 0, /* static_transform_name */
/* startup_gdbarch() */
};
/* Skip verify of skip_permanent_breakpoint, has predicate */
/* Skip verify of overlay_update, has predicate */
/* Skip verify of core_read_description, has predicate */
+ /* Skip verify of static_transform_name, has predicate */
buf = ui_file_xstrdup (log, &dummy);
make_cleanup (xfree, buf);
if (strlen (buf) > 0)
fprintf_unfiltered (file,
"gdbarch_dump: stabs_argument_has_addr = <0x%lx>\n",
(long) current_gdbarch->stabs_argument_has_addr);
+ fprintf_unfiltered (file,
+ "gdbarch_dump: gdbarch_static_transform_name_p() = %d\n",
+ gdbarch_static_transform_name_p (current_gdbarch));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: static_transform_name = <0x%lx>\n",
+ (long) current_gdbarch->static_transform_name);
fprintf_unfiltered (file,
"gdbarch_dump: target_desc = %s\n",
paddr_d ((long) current_gdbarch->target_desc));
gdbarch->core_read_description = core_read_description;
}
+int
+gdbarch_static_transform_name_p (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ return gdbarch->static_transform_name != NULL;
+}
+
+char *
+gdbarch_static_transform_name (struct gdbarch *gdbarch, char *name)
+{
+ gdb_assert (gdbarch != NULL);
+ gdb_assert (gdbarch->static_transform_name != NULL);
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_static_transform_name called\n");
+ return gdbarch->static_transform_name (name);
+}
+
+void
+set_gdbarch_static_transform_name (struct gdbarch *gdbarch,
+ gdbarch_static_transform_name_ftype static_transform_name)
+{
+ gdbarch->static_transform_name = static_transform_name;
+}
+
/* Keep a registry of per-architecture data-pointers required by GDB
modules. */
extern const struct target_desc * gdbarch_core_read_description (struct gdbarch *gdbarch, struct target_ops *target, bfd *abfd);
extern void set_gdbarch_core_read_description (struct gdbarch *gdbarch, gdbarch_core_read_description_ftype *core_read_description);
+/* Handle special encoding of static variables in stabs debug info. */
+
+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);
+extern void set_gdbarch_static_transform_name (struct gdbarch *gdbarch, gdbarch_static_transform_name_ftype *static_transform_name);
+
extern struct gdbarch_tdep *gdbarch_tdep (struct gdbarch *gdbarch);
F::void:overlay_update:struct obj_section *osect:osect
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
EOF
}
return ucontext_addr + 36;
}
+/* 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)
+{
+ char *p;
+ if (name[0] == '.')
+ {
+ /* For file-local statics there will be a period, a bunch of
+ junk (the contents of which match a string given in the
+ N_OPT), a period and the name. For function-local statics
+ there will be a bunch of junk (which seems to change the
+ second character from 'A' to 'B'), a period, the name of the
+ function, and the name. So just skip everything before the
+ last period. */
+ p = strrchr (name, '.');
+ if (p != NULL)
+ name = p + 1;
+ }
+ return name;
+}
+
/* Solaris 2. */
static void
/* Solaris is SVR4-based. */
i386_svr4_init_abi (info, gdbarch);
+ /* Handle SunPRO encoding of static symbols. */
+ set_gdbarch_static_transform_name (gdbarch, i386_sol2_static_transform_name);
+
/* Solaris reserves space for its FPU emulator in `fpregset_t'.
There is also some space reserved for the registers of a Weitek
math coprocessor. */
}
\f
-#ifdef STATIC_TRANSFORM_NAME
-/* SunPRO encodes the static variables. This is not related to C++
- mangling, it is done for C too. */
-
-char *
-sunpro_static_transform_name (char *name)
-{
- char *p;
- if (IS_STATIC_TRANSFORM_NAME (name))
- {
- /* For file-local statics there will be a period, a bunch of
- junk (the contents of which match a string given in the
- N_OPT), a period and the name. For function-local statics
- there will be a bunch of junk (which seems to change the
- second character from 'A' to 'B'), a period, the name of the
- function, and the name. So just skip everything before the
- last period. */
- p = strrchr (name, '.');
- if (p != NULL)
- name = p + 1;
- }
- return name;
-}
-#endif /* STATIC_TRANSFORM_NAME */
-\f
-
/* Stuff for WIN32 PE style DLL's but is pretty generic really. */
CORE_ADDR
{
case 'S':
sh.value += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile));
-#ifdef STATIC_TRANSFORM_NAME
- namestring = STATIC_TRANSFORM_NAME (namestring);
-#endif
+
+ if (gdbarch_static_transform_name_p (current_gdbarch))
+ namestring = gdbarch_static_transform_name
+ (current_gdbarch, namestring);
+
add_psymbol_to_list (namestring, p - namestring,
VAR_DOMAIN, LOC_STATIC,
&objfile->static_psymbols,
return NULL;
}
+
+/* Unglobalize NAME. */
+
+char *
+sparc_sol2_static_transform_name (char *name)
+{
+ /* The Sun compilers (Sun ONE Studio, Forte Developer, Sun WorkShop,
+ SunPRO) convert file static variables into global values, a
+ process known as globalization. In order to do this, the
+ compiler will create a unique prefix and prepend it to each file
+ static variable. For static variables within a function, this
+ globalization prefix is followed by the function name (nested
+ static variables within a function are supposed to generate a
+ warning message, and are left alone). The procedure is
+ documented in the Stabs Interface Manual, which is distrubuted
+ with the compilers, although version 4.0 of the manual seems to
+ be incorrect in some places, at least for SPARC. The
+ globalization prefix is encoded into an N_OPT stab, with the form
+ "G=<prefix>". The globalization prefix always seems to start
+ with a dollar sign '$'; a dot '.' is used as a seperator. So we
+ simply strip everything up until the last dot. */
+
+ if (name[0] == '$')
+ {
+ char *p = strrchr (name, '.');
+ if (p)
+ return p + 1;
+ }
+
+ return name;
+}
\f
void
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ /* The Sun compilers also do "globalization"; see the comment in
+ sparc_sol2_static_transform_name for more information. */
+ set_gdbarch_static_transform_name
+ (gdbarch, sparc_sol2_static_transform_name);
+
/* Solaris has SVR4-style shared libraries... */
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
set_gdbarch_skip_solib_resolver (gdbarch, sol2_skip_solib_resolver);
regcache_cooked_write_unsigned (regcache, tdep->npc_regnum, pc + 4);
}
\f
-/* Unglobalize NAME. */
-
-char *
-sparc_stabs_unglobalize_name (char *name)
-{
- /* The Sun compilers (Sun ONE Studio, Forte Developer, Sun WorkShop,
- SunPRO) convert file static variables into global values, a
- process known as globalization. In order to do this, the
- compiler will create a unique prefix and prepend it to each file
- static variable. For static variables within a function, this
- globalization prefix is followed by the function name (nested
- static variables within a function are supposed to generate a
- warning message, and are left alone). The procedure is
- documented in the Stabs Interface Manual, which is distrubuted
- with the compilers, although version 4.0 of the manual seems to
- be incorrect in some places, at least for SPARC. The
- globalization prefix is encoded into an N_OPT stab, with the form
- "G=<prefix>". The globalization prefix always seems to start
- with a dollar sign '$'; a dot '.' is used as a seperator. So we
- simply strip everything up until the last dot. */
-
- if (name[0] == '$')
- {
- char *p = strrchr (name, '.');
- if (p)
- return p + 1;
- }
-
- return name;
-}
-\f
/* Return the appropriate register set for the core section identified
by SECT_NAME and SECT_SIZE. */
extern int sparc_sol2_pc_in_sigtramp (CORE_ADDR pc, char *name);
+extern char *sparc_sol2_static_transform_name (char *name);
+
extern void sparc32_sol2_init_abi (struct gdbarch_info info,
struct gdbarch *gdbarch);
sparc64_init_abi (info, gdbarch);
+ /* The Sun compilers also do "globalization"; see the comment in
+ sparc_sol2_static_transform_name for more information. */
+ set_gdbarch_static_transform_name
+ (gdbarch, sparc_sol2_static_transform_name);
+
/* Solaris has SVR4-style shared libraries... */
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
set_gdbarch_skip_solib_resolver (gdbarch, sol2_skip_solib_resolver);
/* This was an anonymous type that was never fixed up. */
goto normal;
-#ifdef STATIC_TRANSFORM_NAME
case 'X':
/* SunPRO (3.0 at least) static variable encoding. */
- goto normal;
-#endif
+ if (gdbarch_static_transform_name_p (current_gdbarch))
+ goto normal;
+ /* ... fall through ... */
default:
complaint (&symfile_complaints, _("Unknown C++ symbol name `%s'"),
SYMBOL_TYPE (sym) = read_type (&p, objfile);
SYMBOL_CLASS (sym) = LOC_STATIC;
SYMBOL_VALUE_ADDRESS (sym) = valu;
-#ifdef STATIC_TRANSFORM_NAME
- if (IS_STATIC_TRANSFORM_NAME (DEPRECATED_SYMBOL_NAME (sym)))
+ if (gdbarch_static_transform_name_p (current_gdbarch)
+ && gdbarch_static_transform_name (current_gdbarch,
+ DEPRECATED_SYMBOL_NAME (sym))
+ != DEPRECATED_SYMBOL_NAME (sym))
{
struct minimal_symbol *msym;
msym = lookup_minimal_symbol (DEPRECATED_SYMBOL_NAME (sym), NULL, objfile);
if (msym != NULL)
{
- DEPRECATED_SYMBOL_NAME (sym) = STATIC_TRANSFORM_NAME (DEPRECATED_SYMBOL_NAME (sym));
+ DEPRECATED_SYMBOL_NAME (sym) = gdbarch_static_transform_name
+ (current_gdbarch,
+ DEPRECATED_SYMBOL_NAME (sym));
SYMBOL_VALUE_ADDRESS (sym) = SYMBOL_VALUE_ADDRESS (msym);
}
}
-#endif
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
add_symbol_to_list (sym, &file_symbols);
break;
SYMBOL_TYPE (sym) = read_type (&p, objfile);
SYMBOL_CLASS (sym) = LOC_STATIC;
SYMBOL_VALUE_ADDRESS (sym) = valu;
-#ifdef STATIC_TRANSFORM_NAME
- if (IS_STATIC_TRANSFORM_NAME (DEPRECATED_SYMBOL_NAME (sym)))
+ if (gdbarch_static_transform_name_p (current_gdbarch)
+ && gdbarch_static_transform_name (current_gdbarch,
+ DEPRECATED_SYMBOL_NAME (sym))
+ != DEPRECATED_SYMBOL_NAME (sym))
{
struct minimal_symbol *msym;
msym = lookup_minimal_symbol (DEPRECATED_SYMBOL_NAME (sym), NULL, objfile);
if (msym != NULL)
{
- DEPRECATED_SYMBOL_NAME (sym) = STATIC_TRANSFORM_NAME (DEPRECATED_SYMBOL_NAME (sym));
+ DEPRECATED_SYMBOL_NAME (sym) = gdbarch_static_transform_name
+ (current_gdbarch,
+ DEPRECATED_SYMBOL_NAME (sym));
SYMBOL_VALUE_ADDRESS (sym) = SYMBOL_VALUE_ADDRESS (msym);
}
}
-#endif
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
add_symbol_to_list (sym, &local_symbols);
break;
{
case 'S':
symbol.n_value += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile));
-#ifdef STATIC_TRANSFORM_NAME
- namestring = STATIC_TRANSFORM_NAME (namestring);
-#endif
+
+ if (gdbarch_static_transform_name_p (current_gdbarch))
+ namestring = gdbarch_static_transform_name
+ (current_gdbarch, namestring);
+
add_psymbol_to_list (namestring, p - namestring,
VAR_DOMAIN, LOC_STATIC,
&objfile->static_psymbols,