aboutsummaryrefslogtreecommitdiff
path: root/gdb/i386-sol2-tdep.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/i386-sol2-tdep.c')
-rw-r--r--gdb/i386-sol2-tdep.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/gdb/i386-sol2-tdep.c b/gdb/i386-sol2-tdep.c
index 0f7f8df..586ca96 100644
--- a/gdb/i386-sol2-tdep.c
+++ b/gdb/i386-sol2-tdep.c
@@ -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. */