GNU Binutils with patches for OS216
Revision | d412e69677c6ca145ea8f5ff8c61a22952cb0855 (tree) |
---|---|
Zeit | 2020-06-25 20:43:46 |
Autor | Rainer Orth <ro@CeBi...> |
Commiter | Rainer Orth |
Move common handlers to sol2_init_abi
There's some overlap and duplication between 32 and 64-bit Solaris/SPARC
and x86 tdep files, in particular
*_sol2_sigtramp_p
This patch avoids this by centralizing common code in sol2-tdep.c.
While sparc_sol2_pc_in_sigtramp and sparc_sol2_static_transform_name
were declared in the shared sparc-tdep.h, they were only used in Solaris
files.
Tested on amd64-pc-solaris2.11, i386-pc-solaris2.11,
sparcv9-sun-solaris2.11, and sparc-sun-solaris2.11, and
sparc64-unknown-linux-gnu.
* amd64-sol2-tdep.c (amd64_sol2_sigtramp_p): Remove.
(amd64_sol2_init_abi): Use sol2_sigtramp_p.
Call sol2_init_abi.
set_gdbarch_core_pid_to_str.
* i386-sol2-tdep.c (i386_sol2_sigtramp_p): Remove.
(i386_sol2_static_transform_name): Remove.
(i386_sol2_init_abi): Call sol2_init_abi.
Remove calls to set_gdbarch_sofun_address_maybe_missing,
set_gdbarch_static_transform_name,
set_gdbarch_skip_solib_resolver, set_gdbarch_core_pid_to_str.
Use sol2_sigtramp_p.
* sol2-tdep.c (sol2_pc_in_sigtramp): New function.
(sol2_sigtramp_p): New function.
(sol2_static_transform_name): New function.
(sol2_skip_solib_resolver, sol2_core_pid_to_str): Make static.
(sol2_init_abi): New function.
* sol2-tdep.h (sol2_sigtramp_p, sol2_init_abi): Declare.
(sol2_skip_solib_resolver, sol2_core_pid_to_str): Remove.
* sparc-sol2-tdep.c (sparc_sol2_pc_in_sigtramp): Remove.
(sparc32_sol2_sigtramp_frame_sniffer): Just call sol2_sigtramp_p.
(sparc_sol2_static_transform_name): Remove.
(sparc32_sol2_init_abi): Call sol2_init_abi.
Remove calls to set_gdbarch_sofun_address_maybe_missing,
set_gdbarch_static_transform_name,
set_gdbarch_skip_solib_resolver,
set_gdbarch_core_pid_to_str.
* sparc-tdep.h (sparc_sol2_pc_in_sigtramp)
(sparc_sol2_static_transform_name): Remove
* sparc64-sol2-tdep.c (sparc64_sol2_sigtramp_frame_sniffer): Just
call sol2_sigtramp_p.
(sparc64_sol2_init_abi): Call sol2_init_abi.
Remove calls to set_gdbarch_sofun_address_maybe_missing,
set_gdbarch_static_transform_name,
set_gdbarch_skip_solib_resolver, set_gdbarch_core_pid_to_str.
@@ -1,3 +1,41 @@ | ||
1 | +2020-06-25 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> | |
2 | + | |
3 | + * amd64-sol2-tdep.c (amd64_sol2_sigtramp_p): Remove. | |
4 | + (amd64_sol2_init_abi): Use sol2_sigtramp_p. | |
5 | + Call sol2_init_abi. | |
6 | + Remove calls to set_gdbarch_skip_solib_resolver, | |
7 | + set_gdbarch_core_pid_to_str. | |
8 | + * i386-sol2-tdep.c (i386_sol2_sigtramp_p): Remove. | |
9 | + (i386_sol2_static_transform_name): Remove. | |
10 | + (i386_sol2_init_abi): Call sol2_init_abi. | |
11 | + Remove calls to set_gdbarch_sofun_address_maybe_missing, | |
12 | + set_gdbarch_static_transform_name, | |
13 | + set_gdbarch_skip_solib_resolver, set_gdbarch_core_pid_to_str. | |
14 | + Use sol2_sigtramp_p. | |
15 | + * sol2-tdep.c (sol2_pc_in_sigtramp): New function. | |
16 | + (sol2_sigtramp_p): New function. | |
17 | + (sol2_static_transform_name): New function. | |
18 | + (sol2_skip_solib_resolver, sol2_core_pid_to_str): Make static. | |
19 | + (sol2_init_abi): New function. | |
20 | + * sol2-tdep.h (sol2_sigtramp_p, sol2_init_abi): Declare. | |
21 | + (sol2_skip_solib_resolver, sol2_core_pid_to_str): Remove. | |
22 | + * sparc-sol2-tdep.c (sparc_sol2_pc_in_sigtramp): Remove. | |
23 | + (sparc32_sol2_sigtramp_frame_sniffer): Just call sol2_sigtramp_p. | |
24 | + (sparc_sol2_static_transform_name): Remove. | |
25 | + (sparc32_sol2_init_abi): Call sol2_init_abi. | |
26 | + Remove calls to set_gdbarch_sofun_address_maybe_missing, | |
27 | + set_gdbarch_static_transform_name, | |
28 | + set_gdbarch_skip_solib_resolver, | |
29 | + set_gdbarch_core_pid_to_str. | |
30 | + * sparc-tdep.h (sparc_sol2_pc_in_sigtramp) | |
31 | + (sparc_sol2_static_transform_name): Remove | |
32 | + * sparc64-sol2-tdep.c (sparc64_sol2_sigtramp_frame_sniffer): Just | |
33 | + call sol2_sigtramp_p. | |
34 | + (sparc64_sol2_init_abi): Call sol2_init_abi. | |
35 | + Remove calls to set_gdbarch_sofun_address_maybe_missing, | |
36 | + set_gdbarch_static_transform_name, | |
37 | + set_gdbarch_skip_solib_resolver, set_gdbarch_core_pid_to_str. | |
38 | + | |
1 | 39 | 2020-06-24 Philippe Waroquiers <philippe.waroquiers@skynet.be> |
2 | 40 | |
3 | 41 | * symfile-add-flags.h: New flag SYMFILE_ALWAYS_CONFIRM. |
@@ -63,21 +63,6 @@ static int amd64_sol2_gregset_reg_offset[] = { | ||
63 | 63 | }; |
64 | 64 | |
65 | 65 | |
66 | -/* Return whether THIS_FRAME corresponds to a Solaris sigtramp | |
67 | - routine. */ | |
68 | - | |
69 | -static int | |
70 | -amd64_sol2_sigtramp_p (struct frame_info *this_frame) | |
71 | -{ | |
72 | - CORE_ADDR pc = get_frame_pc (this_frame); | |
73 | - const char *name; | |
74 | - | |
75 | - find_pc_partial_function (pc, &name, NULL, NULL); | |
76 | - return (name && (strcmp ("sigacthandler", name) == 0 | |
77 | - || strcmp (name, "ucbsigvechandler") == 0 | |
78 | - || strcmp (name, "__sighndlr") == 0)); | |
79 | -} | |
80 | - | |
81 | 66 | /* Solaris doesn't have a 'struct sigcontext', but it does have a |
82 | 67 | 'mcontext_t' that contains the saved set of machine registers. */ |
83 | 68 |
@@ -104,18 +89,16 @@ amd64_sol2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) | ||
104 | 89 | amd64_init_abi (info, gdbarch, |
105 | 90 | amd64_target_description (X86_XSTATE_SSE_MASK, true)); |
106 | 91 | |
107 | - tdep->sigtramp_p = amd64_sol2_sigtramp_p; | |
92 | + sol2_init_abi (info, gdbarch); | |
93 | + | |
94 | + tdep->sigtramp_p = sol2_sigtramp_p; | |
108 | 95 | tdep->sigcontext_addr = amd64_sol2_mcontext_addr; |
109 | 96 | tdep->sc_reg_offset = tdep->gregset_reg_offset; |
110 | 97 | tdep->sc_num_regs = tdep->gregset_num_regs; |
111 | 98 | |
112 | 99 | /* Solaris uses SVR4-style shared libraries. */ |
113 | - set_gdbarch_skip_solib_resolver (gdbarch, sol2_skip_solib_resolver); | |
114 | 100 | set_solib_svr4_fetch_link_map_offsets |
115 | 101 | (gdbarch, svr4_lp64_fetch_link_map_offsets); |
116 | - | |
117 | - /* How to print LWP PTIDs from core files. */ | |
118 | - set_gdbarch_core_pid_to_str (gdbarch, sol2_core_pid_to_str); | |
119 | 102 | } |
120 | 103 | |
121 | 104 | void _initialize_amd64_sol2_tdep (); |
@@ -46,21 +46,6 @@ static int i386_sol2_gregset_reg_offset[] = | ||
46 | 46 | 0 * 4 /* %gs */ |
47 | 47 | }; |
48 | 48 | |
49 | -/* Return whether THIS_FRAME corresponds to a Solaris sigtramp | |
50 | - routine. */ | |
51 | - | |
52 | -static int | |
53 | -i386_sol2_sigtramp_p (struct frame_info *this_frame) | |
54 | -{ | |
55 | - CORE_ADDR pc = get_frame_pc (this_frame); | |
56 | - const char *name; | |
57 | - | |
58 | - find_pc_partial_function (pc, &name, NULL, NULL); | |
59 | - return (name && (strcmp ("sigacthandler", name) == 0 | |
60 | - || strcmp (name, "ucbsigvechandler") == 0 | |
61 | - || strcmp (name, "__sighndlr") == 0)); | |
62 | -} | |
63 | - | |
64 | 49 | /* Solaris doesn't have a `struct sigcontext', but it does have a |
65 | 50 | `mcontext_t' that contains the saved set of machine registers. */ |
66 | 51 |
@@ -75,30 +60,6 @@ i386_sol2_mcontext_addr (struct frame_info *this_frame) | ||
75 | 60 | return ucontext_addr + 36; |
76 | 61 | } |
77 | 62 | |
78 | -/* SunPRO encodes the static variables. This is not related to C++ | |
79 | - mangling, it is done for C too. */ | |
80 | - | |
81 | -static const char * | |
82 | -i386_sol2_static_transform_name (const char *name) | |
83 | -{ | |
84 | - if (name[0] == '.') | |
85 | - { | |
86 | - const char *p; | |
87 | - | |
88 | - /* For file-local statics there will be a period, a bunch of | |
89 | - junk (the contents of which match a string given in the | |
90 | - N_OPT), a period and the name. For function-local statics | |
91 | - there will be a bunch of junk (which seems to change the | |
92 | - second character from 'A' to 'B'), a period, the name of the | |
93 | - function, and the name. So just skip everything before the | |
94 | - last period. */ | |
95 | - p = strrchr (name, '.'); | |
96 | - if (p != NULL) | |
97 | - name = p + 1; | |
98 | - } | |
99 | - return name; | |
100 | -} | |
101 | - | |
102 | 63 | /* Solaris 2. */ |
103 | 64 | |
104 | 65 | static void |
@@ -109,12 +70,7 @@ i386_sol2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) | ||
109 | 70 | /* Solaris is SVR4-based. */ |
110 | 71 | i386_svr4_init_abi (info, gdbarch); |
111 | 72 | |
112 | - /* The SunPRO compiler puts out 0 instead of the address in N_SO symbols, | |
113 | - and for SunPRO 3.0, N_FUN symbols too. */ | |
114 | - set_gdbarch_sofun_address_maybe_missing (gdbarch, 1); | |
115 | - | |
116 | - /* Handle SunPRO encoding of static symbols. */ | |
117 | - set_gdbarch_static_transform_name (gdbarch, i386_sol2_static_transform_name); | |
73 | + sol2_init_abi (info, gdbarch); | |
118 | 74 | |
119 | 75 | /* Solaris reserves space for its FPU emulator in `fpregset_t'. |
120 | 76 | There is also some space reserved for the registers of a Weitek |
@@ -125,18 +81,14 @@ i386_sol2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) | ||
125 | 81 | tdep->sizeof_fpregset = 380; |
126 | 82 | |
127 | 83 | /* Signal trampolines are slightly different from SVR4. */ |
128 | - tdep->sigtramp_p = i386_sol2_sigtramp_p; | |
84 | + tdep->sigtramp_p = sol2_sigtramp_p; | |
129 | 85 | tdep->sigcontext_addr = i386_sol2_mcontext_addr; |
130 | 86 | tdep->sc_reg_offset = tdep->gregset_reg_offset; |
131 | 87 | tdep->sc_num_regs = tdep->gregset_num_regs; |
132 | 88 | |
133 | 89 | /* Solaris has SVR4-style shared libraries. */ |
134 | - set_gdbarch_skip_solib_resolver (gdbarch, sol2_skip_solib_resolver); | |
135 | 90 | set_solib_svr4_fetch_link_map_offsets |
136 | 91 | (gdbarch, svr4_ilp32_fetch_link_map_offsets); |
137 | - | |
138 | - /* How to print LWP PTIDs from core files. */ | |
139 | - set_gdbarch_core_pid_to_str (gdbarch, sol2_core_pid_to_str); | |
140 | 92 | } |
141 | 93 | |
142 | 94 |
@@ -25,7 +25,89 @@ | ||
25 | 25 | |
26 | 26 | #include "sol2-tdep.h" |
27 | 27 | |
28 | -CORE_ADDR | |
28 | +/* The Solaris signal trampolines reside in libc. For normal signals, | |
29 | + the function `sigacthandler' is used. This signal trampoline will | |
30 | + call the signal handler using the System V calling convention, | |
31 | + where the third argument is a pointer to an instance of | |
32 | + `ucontext_t', which has a member `uc_mcontext' that contains the | |
33 | + saved registers. Incidentally, the kernel passes the `ucontext_t' | |
34 | + pointer as the third argument of the signal trampoline too, and | |
35 | + `sigacthandler' simply passes it on. However, if you link your | |
36 | + program with "-L/usr/ucblib -R/usr/ucblib -lucb", the function | |
37 | + `ucbsigvechandler' will be used, which invokes the using the BSD | |
38 | + convention, where the third argument is a pointer to an instance of | |
39 | + `struct sigcontext'. It is the `ucbsigvechandler' function that | |
40 | + converts the `ucontext_t' to a `sigcontext', and back. Unless the | |
41 | + signal handler modifies the `struct sigcontext' we can safely | |
42 | + ignore this. */ | |
43 | + | |
44 | +static int | |
45 | +sol2_pc_in_sigtramp (CORE_ADDR pc, const char *name) | |
46 | +{ | |
47 | + return (name && (strcmp (name, "sigacthandler") == 0 | |
48 | + || strcmp (name, "ucbsigvechandler") == 0 | |
49 | + || strcmp (name, "__sighndlr") == 0)); | |
50 | +} | |
51 | + | |
52 | +/* Return whether THIS_FRAME corresponds to a Solaris sigtramp routine. */ | |
53 | + | |
54 | +int | |
55 | +sol2_sigtramp_p (struct frame_info *this_frame) | |
56 | +{ | |
57 | + CORE_ADDR pc = get_frame_pc (this_frame); | |
58 | + const char *name; | |
59 | + | |
60 | + find_pc_partial_function (pc, &name, NULL, NULL); | |
61 | + return sol2_pc_in_sigtramp (pc, name); | |
62 | +} | |
63 | + | |
64 | +/* Unglobalize NAME. */ | |
65 | + | |
66 | +static const char * | |
67 | +sol2_static_transform_name (const char *name) | |
68 | +{ | |
69 | + /* The Sun compilers (Sun ONE Studio, Forte Developer, Sun WorkShop, | |
70 | + SunPRO) convert file static variables into global values, a | |
71 | + process known as globalization. In order to do this, the | |
72 | + compiler will create a unique prefix and prepend it to each file | |
73 | + static variable. For static variables within a function, this | |
74 | + globalization prefix is followed by the function name (nested | |
75 | + static variables within a function are supposed to generate a | |
76 | + warning message, and are left alone). The procedure is | |
77 | + documented in the Stabs Interface Manual, which is distributed | |
78 | + with the compilers, although version 4.0 of the manual seems to | |
79 | + be incorrect in some places, at least for SPARC. The | |
80 | + globalization prefix is encoded into an N_OPT stab, with the form | |
81 | + "G=<prefix>". The globalization prefix always seems to start | |
82 | + with a dollar sign '$' (sparc) resp. a dot '.' (x86); a dot '.' | |
83 | + is used as a separator. So we simply strip everything up until | |
84 | + the last dot. */ | |
85 | + int prefix; | |
86 | + | |
87 | + switch (gdbarch_bfd_arch_info (target_gdbarch ())->arch) | |
88 | + { | |
89 | + case bfd_arch_i386: | |
90 | + prefix = '.'; | |
91 | + break; | |
92 | + case bfd_arch_sparc: | |
93 | + prefix = '$'; | |
94 | + break; | |
95 | + default: | |
96 | + internal_error (__FILE__, __LINE__, "Unexpected arch"); | |
97 | + break; | |
98 | + } | |
99 | + | |
100 | + if (name[0] == prefix) | |
101 | + { | |
102 | + const char *p = strrchr (name, '.'); | |
103 | + if (p) | |
104 | + return p + 1; | |
105 | + } | |
106 | + | |
107 | + return name; | |
108 | +} | |
109 | + | |
110 | +static CORE_ADDR | |
29 | 111 | sol2_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc) |
30 | 112 | { |
31 | 113 | struct bound_minimal_symbol msym; |
@@ -37,17 +119,15 @@ sol2_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc) | ||
37 | 119 | return 0; |
38 | 120 | } |
39 | 121 | |
40 | -/* This is how we want PTIDs from Solaris core files to be | |
41 | - printed. */ | |
122 | +/* This is how we want PTIDs from Solaris core files to be printed. */ | |
42 | 123 | |
43 | -std::string | |
124 | +static std::string | |
44 | 125 | sol2_core_pid_to_str (struct gdbarch *gdbarch, ptid_t ptid) |
45 | 126 | { |
46 | 127 | struct inferior *inf; |
47 | 128 | int pid; |
48 | 129 | |
49 | - /* Check whether we're printing an LWP (gdb thread) or a | |
50 | - process. */ | |
130 | + /* Check whether we're printing an LWP (gdb thread) or a process. */ | |
51 | 131 | pid = ptid.lwp (); |
52 | 132 | if (pid != 0) |
53 | 133 | { |
@@ -56,8 +136,7 @@ sol2_core_pid_to_str (struct gdbarch *gdbarch, ptid_t ptid) | ||
56 | 136 | } |
57 | 137 | |
58 | 138 | /* GDB didn't use to put a NT_PSTATUS note in Solaris cores. If |
59 | - that's missing, then we're dealing with a fake PID corelow.c made | |
60 | - up. */ | |
139 | + that's missing, then we're dealing with a fake PID corelow.c made up. */ | |
61 | 140 | inf = find_inferior_ptid (current_inferior ()->process_target (), ptid); |
62 | 141 | if (inf == NULL || inf->fake_pid_p) |
63 | 142 | return "<core>"; |
@@ -65,3 +144,24 @@ sol2_core_pid_to_str (struct gdbarch *gdbarch, ptid_t ptid) | ||
65 | 144 | /* Not fake; print as usual. */ |
66 | 145 | return normal_pid_to_str (ptid); |
67 | 146 | } |
147 | + | |
148 | +/* To be called from GDB_OSABI_SOLARIS handlers. */ | |
149 | + | |
150 | +void | |
151 | +sol2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) | |
152 | +{ | |
153 | + /* The Sun compilers (Sun ONE Studio, Forte Developer, Sun WorkShop, SunPRO) | |
154 | + compiler puts out 0 instead of the address in N_SO stabs. Starting with | |
155 | + SunPRO 3.0, the compiler does this for N_FUN stabs too. */ | |
156 | + set_gdbarch_sofun_address_maybe_missing (gdbarch, 1); | |
157 | + | |
158 | + /* The Sun compilers also do "globalization"; see the comment in | |
159 | + sol2_static_transform_name for more information. */ | |
160 | + set_gdbarch_static_transform_name (gdbarch, sol2_static_transform_name); | |
161 | + | |
162 | + /* Solaris uses SVR4-style shared libraries. */ | |
163 | + set_gdbarch_skip_solib_resolver (gdbarch, sol2_skip_solib_resolver); | |
164 | + | |
165 | + /* How to print LWP PTIDs from core files. */ | |
166 | + set_gdbarch_core_pid_to_str (gdbarch, sol2_core_pid_to_str); | |
167 | +} |
@@ -22,8 +22,8 @@ | ||
22 | 22 | |
23 | 23 | struct gdbarch; |
24 | 24 | |
25 | -CORE_ADDR sol2_skip_solib_resolver (struct gdbarch *, CORE_ADDR); | |
25 | +int sol2_sigtramp_p (struct frame_info *this_frame); | |
26 | 26 | |
27 | -std::string sol2_core_pid_to_str (struct gdbarch *gdbarch, ptid_t ptid); | |
27 | +void sol2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch); | |
28 | 28 | |
29 | 29 | #endif /* sol2-tdep.h */ |
@@ -99,30 +99,6 @@ static const struct regset sparc32_sol2_fpregset = | ||
99 | 99 | }; |
100 | 100 | |
101 | 101 | |
102 | -/* The Solaris signal trampolines reside in libc. For normal signals, | |
103 | - the function `sigacthandler' is used. This signal trampoline will | |
104 | - call the signal handler using the System V calling convention, | |
105 | - where the third argument is a pointer to an instance of | |
106 | - `ucontext_t', which has a member `uc_mcontext' that contains the | |
107 | - saved registers. Incidentally, the kernel passes the `ucontext_t' | |
108 | - pointer as the third argument of the signal trampoline too, and | |
109 | - `sigacthandler' simply passes it on. However, if you link your | |
110 | - program with "-L/usr/ucblib -R/usr/ucblib -lucb", the function | |
111 | - `ucbsigvechandler' will be used, which invokes the using the BSD | |
112 | - convention, where the third argument is a pointer to an instance of | |
113 | - `struct sigcontext'. It is the `ucbsigvechandler' function that | |
114 | - converts the `ucontext_t' to a `sigcontext', and back. Unless the | |
115 | - signal handler modifies the `struct sigcontext' we can safely | |
116 | - ignore this. */ | |
117 | - | |
118 | -int | |
119 | -sparc_sol2_pc_in_sigtramp (CORE_ADDR pc, const char *name) | |
120 | -{ | |
121 | - return (name && (strcmp (name, "sigacthandler") == 0 | |
122 | - || strcmp (name, "ucbsigvechandler") == 0 | |
123 | - || strcmp (name, "__sighndlr") == 0)); | |
124 | -} | |
125 | - | |
126 | 102 | static struct sparc_frame_cache * |
127 | 103 | sparc32_sol2_sigtramp_frame_cache (struct frame_info *this_frame, |
128 | 104 | void **this_cache) |
@@ -201,14 +177,7 @@ sparc32_sol2_sigtramp_frame_sniffer (const struct frame_unwind *self, | ||
201 | 177 | struct frame_info *this_frame, |
202 | 178 | void **this_cache) |
203 | 179 | { |
204 | - CORE_ADDR pc = get_frame_pc (this_frame); | |
205 | - const char *name; | |
206 | - | |
207 | - find_pc_partial_function (pc, &name, NULL, NULL); | |
208 | - if (sparc_sol2_pc_in_sigtramp (pc, name)) | |
209 | - return 1; | |
210 | - | |
211 | - return 0; | |
180 | + return sol2_sigtramp_p (this_frame); | |
212 | 181 | } |
213 | 182 | |
214 | 183 | static const struct frame_unwind sparc32_sol2_sigtramp_frame_unwind = |
@@ -221,36 +190,6 @@ static const struct frame_unwind sparc32_sol2_sigtramp_frame_unwind = | ||
221 | 190 | sparc32_sol2_sigtramp_frame_sniffer |
222 | 191 | }; |
223 | 192 | |
224 | -/* Unglobalize NAME. */ | |
225 | - | |
226 | -const char * | |
227 | -sparc_sol2_static_transform_name (const char *name) | |
228 | -{ | |
229 | - /* The Sun compilers (Sun ONE Studio, Forte Developer, Sun WorkShop, | |
230 | - SunPRO) convert file static variables into global values, a | |
231 | - process known as globalization. In order to do this, the | |
232 | - compiler will create a unique prefix and prepend it to each file | |
233 | - static variable. For static variables within a function, this | |
234 | - globalization prefix is followed by the function name (nested | |
235 | - static variables within a function are supposed to generate a | |
236 | - warning message, and are left alone). The procedure is | |
237 | - documented in the Stabs Interface Manual, which is distributed | |
238 | - with the compilers, although version 4.0 of the manual seems to | |
239 | - be incorrect in some places, at least for SPARC. The | |
240 | - globalization prefix is encoded into an N_OPT stab, with the form | |
241 | - "G=<prefix>". The globalization prefix always seems to start | |
242 | - with a dollar sign '$'; a dot '.' is used as a separator. So we | |
243 | - simply strip everything up until the last dot. */ | |
244 | - | |
245 | - if (name[0] == '$') | |
246 | - { | |
247 | - const char *p = strrchr (name, '.'); | |
248 | - if (p) | |
249 | - return p + 1; | |
250 | - } | |
251 | - | |
252 | - return name; | |
253 | -} | |
254 | 193 | |
255 | 194 | |
256 | 195 | void |
@@ -264,19 +203,10 @@ sparc32_sol2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) | ||
264 | 203 | tdep->fpregset = &sparc32_sol2_fpregset; |
265 | 204 | tdep->sizeof_fpregset = 400; |
266 | 205 | |
267 | - /* The Sun compilers (Sun ONE Studio, Forte Developer, Sun WorkShop, SunPRO) | |
268 | - compiler puts out 0 instead of the address in N_SO stabs. Starting with | |
269 | - SunPRO 3.0, the compiler does this for N_FUN stabs too. */ | |
270 | - set_gdbarch_sofun_address_maybe_missing (gdbarch, 1); | |
271 | - | |
272 | - /* The Sun compilers also do "globalization"; see the comment in | |
273 | - sparc_sol2_static_transform_name for more information. */ | |
274 | - set_gdbarch_static_transform_name | |
275 | - (gdbarch, sparc_sol2_static_transform_name); | |
206 | + sol2_init_abi (info, gdbarch); | |
276 | 207 | |
277 | 208 | /* Solaris has SVR4-style shared libraries... */ |
278 | 209 | set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target); |
279 | - set_gdbarch_skip_solib_resolver (gdbarch, sol2_skip_solib_resolver); | |
280 | 210 | set_solib_svr4_fetch_link_map_offsets |
281 | 211 | (gdbarch, svr4_ilp32_fetch_link_map_offsets); |
282 | 212 |
@@ -288,9 +218,6 @@ sparc32_sol2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) | ||
288 | 218 | set_gdbarch_software_single_step (gdbarch, NULL); |
289 | 219 | |
290 | 220 | frame_unwind_append_unwinder (gdbarch, &sparc32_sol2_sigtramp_frame_unwind); |
291 | - | |
292 | - /* How to print LWP PTIDs from core files. */ | |
293 | - set_gdbarch_core_pid_to_str (gdbarch, sol2_core_pid_to_str); | |
294 | 221 | } |
295 | 222 | |
296 | 223 | void _initialize_sparc_sol2_tdep (); |
@@ -245,10 +245,6 @@ extern int sparc_is_annulled_branch_insn (CORE_ADDR pc); | ||
245 | 245 | extern const struct sparc_gregmap sparc32_sol2_gregmap; |
246 | 246 | extern const struct sparc_fpregmap sparc32_sol2_fpregmap; |
247 | 247 | |
248 | -extern int sparc_sol2_pc_in_sigtramp (CORE_ADDR pc, const char *name); | |
249 | - | |
250 | -extern const char *sparc_sol2_static_transform_name (const char *name); | |
251 | - | |
252 | 248 | extern void sparc32_sol2_init_abi (struct gdbarch_info info, |
253 | 249 | struct gdbarch *gdbarch); |
254 | 250 |
@@ -180,15 +180,9 @@ sparc64_sol2_sigtramp_frame_sniffer (const struct frame_unwind *self, | ||
180 | 180 | struct frame_info *this_frame, |
181 | 181 | void **this_cache) |
182 | 182 | { |
183 | - CORE_ADDR pc = get_frame_pc (this_frame); | |
184 | - const char *name; | |
185 | - | |
186 | - find_pc_partial_function (pc, &name, NULL, NULL); | |
187 | - if (sparc_sol2_pc_in_sigtramp (pc, name)) | |
188 | - return 1; | |
189 | - | |
190 | - return 0; | |
183 | + return sol2_sigtramp_p (this_frame); | |
191 | 184 | } |
185 | + | |
192 | 186 | static const struct frame_unwind sparc64_sol2_sigtramp_frame_unwind = |
193 | 187 | { |
194 | 188 | SIGTRAMP_FRAME, |
@@ -216,19 +210,10 @@ sparc64_sol2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) | ||
216 | 210 | |
217 | 211 | sparc64_init_abi (info, gdbarch); |
218 | 212 | |
219 | - /* The Sun compilers (Sun ONE Studio, Forte Developer, Sun WorkShop, SunPRO) | |
220 | - compiler puts out 0 instead of the address in N_SO stabs. Starting with | |
221 | - SunPRO 3.0, the compiler does this for N_FUN stabs too. */ | |
222 | - set_gdbarch_sofun_address_maybe_missing (gdbarch, 1); | |
223 | - | |
224 | - /* The Sun compilers also do "globalization"; see the comment in | |
225 | - sparc_sol2_static_transform_name for more information. */ | |
226 | - set_gdbarch_static_transform_name | |
227 | - (gdbarch, sparc_sol2_static_transform_name); | |
213 | + sol2_init_abi (info, gdbarch); | |
228 | 214 | |
229 | 215 | /* Solaris has SVR4-style shared libraries... */ |
230 | 216 | set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target); |
231 | - set_gdbarch_skip_solib_resolver (gdbarch, sol2_skip_solib_resolver); | |
232 | 217 | set_solib_svr4_fetch_link_map_offsets |
233 | 218 | (gdbarch, svr4_lp64_fetch_link_map_offsets); |
234 | 219 |
@@ -238,9 +223,6 @@ sparc64_sol2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) | ||
238 | 223 | |
239 | 224 | /* Solaris has kernel-assisted single-stepping support. */ |
240 | 225 | set_gdbarch_software_single_step (gdbarch, NULL); |
241 | - | |
242 | - /* How to print LWP PTIDs from core files. */ | |
243 | - set_gdbarch_core_pid_to_str (gdbarch, sol2_core_pid_to_str); | |
244 | 226 | } |
245 | 227 | |
246 | 228 | void _initialize_sparc64_sol2_tdep (); |