mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-01-24 12:35:55 +08:00
* 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.
This commit is contained in:
parent
603b72571d
commit
149ad273c5
@ -1,3 +1,27 @@
|
||||
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.
|
||||
|
@ -24,8 +24,4 @@
|
||||
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 */
|
||||
|
@ -26,12 +26,4 @@
|
||||
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 */
|
||||
|
@ -1680,9 +1680,11 @@ read_dbx_symtab (struct objfile *objfile)
|
||||
{
|
||||
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,
|
||||
|
@ -227,6 +227,7 @@ struct gdbarch
|
||||
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;
|
||||
};
|
||||
|
||||
|
||||
@ -346,6 +347,7 @@ struct gdbarch startup_gdbarch =
|
||||
0, /* skip_permanent_breakpoint */
|
||||
0, /* overlay_update */
|
||||
0, /* core_read_description */
|
||||
0, /* static_transform_name */
|
||||
/* startup_gdbarch() */
|
||||
};
|
||||
|
||||
@ -590,6 +592,7 @@ verify_gdbarch (struct gdbarch *current_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)
|
||||
@ -983,6 +986,12 @@ gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file)
|
||||
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));
|
||||
@ -2931,6 +2940,30 @@ set_gdbarch_core_read_description (struct gdbarch *gdbarch,
|
||||
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. */
|
||||
|
@ -664,6 +664,14 @@ typedef const struct target_desc * (gdbarch_core_read_description_ftype) (struct
|
||||
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);
|
||||
|
||||
|
||||
|
@ -638,6 +638,9 @@ F::void:skip_permanent_breakpoint:struct regcache *regcache:regcache
|
||||
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
|
||||
}
|
||||
|
||||
|
@ -76,6 +76,29 @@ i386_sol2_mcontext_addr (struct frame_info *next_frame)
|
||||
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
|
||||
@ -86,6 +109,9 @@ i386_sol2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
||||
/* 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. */
|
||||
|
@ -2067,32 +2067,6 @@ i386_regset_from_core_section (struct gdbarch *gdbarch,
|
||||
}
|
||||
|
||||
|
||||
#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 */
|
||||
|
||||
|
||||
/* Stuff for WIN32 PE style DLL's but is pretty generic really. */
|
||||
|
||||
CORE_ADDR
|
||||
|
@ -2999,9 +2999,11 @@ parse_partial_symbols (struct objfile *objfile)
|
||||
{
|
||||
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,
|
||||
|
@ -168,6 +168,37 @@ sparc32_sol2_sigtramp_frame_sniffer (struct frame_info *next_frame)
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
@ -175,6 +206,11 @@ sparc32_sol2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
||||
{
|
||||
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);
|
||||
|
@ -1354,37 +1354,6 @@ sparc_write_pc (struct regcache *regcache, CORE_ADDR pc)
|
||||
regcache_cooked_write_unsigned (regcache, tdep->npc_regnum, pc + 4);
|
||||
}
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
|
||||
/* Return the appropriate register set for the core section identified
|
||||
by SECT_NAME and SECT_SIZE. */
|
||||
|
@ -190,6 +190,8 @@ extern const struct sparc_gregset sparc32_sol2_gregset;
|
||||
|
||||
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);
|
||||
|
||||
|
@ -157,6 +157,11 @@ sparc64_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);
|
||||
|
@ -664,11 +664,11 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
|
||||
/* 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'"),
|
||||
@ -1096,18 +1096,21 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
|
||||
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;
|
||||
@ -1276,18 +1279,21 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
|
||||
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;
|
||||
|
@ -2581,9 +2581,11 @@ scan_xcoff_symtab (struct objfile *objfile)
|
||||
{
|
||||
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,
|
||||
|
Loading…
Reference in New Issue
Block a user