]>
Commit | Line | Data |
---|---|---|
3a58abaf AM |
1 | 2006-10-01 Jan Kratochvil <jan.kratochvil@redhat.com> |
2 | Fujitsu | |
3 | ||
4 | * amd64-linux-nat.c: Support new linux_elfcore_write_prpsinfo, | |
5 | linux_elfcore_write_prstatus, linux_elfcore_write_prfpreg. | |
6 | (i386_linux_gregset32_reg_offset): New mapping for i386 on amd64. | |
7 | * gcore.c (gcore_create_callback): Comment vdso Linux kernel bug. | |
8 | * configure.ac: Check for <sys/user32.h>, <sys/procfs32.h>. | |
9 | * configure, config.in: Regenerated. | |
10 | * gdb_user32.h, gdb_procfs32.h: Define 32-bit core files even for | |
11 | 64-bit gdb, provide fallbacks for <sys/user32.h> and <sys/procfs32.h>. | |
12 | * linux-nat.c: Virtualize `elfcore_*' by (*`linux_elfcore_*'). | |
13 | (linux_nat_do_thread_registers): Likewise. | |
14 | (linux_nat_make_corefile_notes): Likewise. | |
15 | * linux-nat.h: Likewise. | |
16 | * Makefile.in: Dependencies updated. | |
17 | ||
18 | 2007-10-16 Jan Kratochvil <jan.kratochvil@redhat.com> | |
19 | ||
20 | Port to GDB-6.7. | |
21 | ||
22 | 2008-02-24 Jan Kratochvil <jan.kratochvil@redhat.com> | |
23 | ||
24 | Port to GDB-6.8pre. | |
25 | ||
7566401a | 26 | Index: gdb-6.8.50.20090802/gdb/amd64-linux-nat.c |
3a58abaf | 27 | =================================================================== |
7566401a ER |
28 | --- gdb-6.8.50.20090802.orig/gdb/amd64-linux-nat.c 2009-06-17 20:44:23.000000000 +0200 |
29 | +++ gdb-6.8.50.20090802/gdb/amd64-linux-nat.c 2009-08-03 15:49:33.000000000 +0200 | |
30 | @@ -51,6 +51,9 @@ | |
3a58abaf AM |
31 | #include "i386-linux-tdep.h" |
32 | #include "amd64-nat.h" | |
7566401a | 33 | #include "i386-nat.h" |
3a58abaf AM |
34 | +#include "i387-tdep.h" |
35 | +#include "elf-bfd.h" | |
36 | +#include "gdb_procfs32.h" | |
37 | ||
38 | /* Mapping between the general-purpose registers in GNU/Linux x86-64 | |
39 | `struct user' format and GDB's register cache layout. */ | |
7566401a | 40 | @@ -85,6 +88,35 @@ static int amd64_linux_gregset64_reg_off |
3a58abaf AM |
41 | GNU/Linux i386 registers are all 32-bit, but since we're |
42 | little-endian we get away with that. */ | |
43 | ||
44 | +/* This info is not reusable from "i386-linux-nat.c" as gdb itself runs in | |
45 | + 64-bit mode and so ptrace(2) has 64-bit structure layout. | |
46 | + Just the corefile being generated has 32-bit layout so we need to do | |
47 | + a conversion specific to the i386-on-amd64 compatibility mode. */ | |
48 | +static int i386_linux_gregset32_reg_offset[] = | |
49 | +{ | |
50 | + 6 * 4, /* %eax */ | |
51 | + 1 * 4, /* %ecx */ | |
52 | + 2 * 4, /* %edx */ | |
53 | + 0 * 4, /* %ebx */ | |
54 | + 15 * 4, /* %esp */ | |
55 | + 5 * 4, /* %ebp */ | |
56 | + 3 * 4, /* %esi */ | |
57 | + 4 * 4, /* %edi */ | |
58 | + 12 * 4, /* %eip */ | |
59 | + 14 * 4, /* %eflags */ | |
60 | + 13 * 4, /* %cs */ | |
61 | + 16 * 4, /* %ss */ | |
62 | + 7 * 4, /* %ds */ | |
63 | + 8 * 4, /* %es */ | |
64 | + 9 * 4, /* %fs */ | |
65 | + 10 * 4, /* %gs */ | |
66 | + -1, -1, -1, -1, -1, -1, -1, -1, | |
67 | + -1, -1, -1, -1, -1, -1, -1, -1, | |
68 | + -1, -1, -1, -1, -1, -1, -1, -1, | |
69 | + -1, | |
70 | + 11 * 4 /* "orig_eax" */ | |
71 | +}; | |
72 | + | |
73 | /* From <sys/reg.h> on GNU/Linux i386. */ | |
74 | static int amd64_linux_gregset32_reg_offset[] = | |
75 | { | |
7566401a | 76 | @@ -103,6 +135,96 @@ static int amd64_linux_gregset32_reg_off |
3a58abaf AM |
77 | }; |
78 | \f | |
79 | ||
80 | +/* This functions make ELF32 32-bit elfcore note sections | |
81 | + on amd64 environment. */ | |
82 | + | |
83 | +static char * | |
84 | +amd64_linux_elfcore_write_prpsinfo (bfd *abfd, char *buf, int *bufsiz, | |
85 | + const char *fname, const char *psargs) | |
86 | +{ | |
7566401a | 87 | + if (gdbarch_ptr_bit (target_gdbarch) == 32) |
3a58abaf AM |
88 | + { |
89 | + int note_type; | |
90 | + char *note_name = "CORE"; | |
91 | + struct elf_prpsinfo32 data; | |
92 | + note_type = NT_PRPSINFO; | |
93 | + | |
94 | + memset (&data, 0, sizeof (data)); | |
95 | + strncpy (data.pr_fname, fname, sizeof (data.pr_fname)); | |
96 | + strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs)); | |
97 | + return elfcore_write_note (abfd, buf, bufsiz, | |
98 | + note_name, note_type, &data, sizeof (data)); | |
99 | + } | |
100 | + else | |
101 | + return elfcore_write_prpsinfo (abfd, buf, bufsiz, fname, psargs); | |
102 | +} | |
103 | + | |
104 | +static void | |
105 | +amd64_linux_set_registers (const gdb_byte *gregs, gdb_byte *buf) | |
106 | +{ | |
107 | + int i; | |
108 | + /* Copy the i386 registers in the amd64 layout into i386 layout. */ | |
109 | + for (i = 0; i < I386_NUM_GREGS; i++) | |
110 | + memcpy(buf + i386_linux_gregset32_reg_offset[i], | |
111 | + gregs + amd64_linux_gregset32_reg_offset[i], 4); | |
112 | + for (i = I386_CS_REGNUM; i <= I386_GS_REGNUM; i++) | |
113 | + memcpy(buf + i386_linux_gregset32_reg_offset[i], | |
114 | + gregs + amd64_linux_gregset32_reg_offset[i], 4); | |
115 | +} | |
116 | + | |
117 | +static char * | |
118 | +amd64_linux_elfcore_write_prstatus (bfd *abfd, char *buf, int *bufsiz, | |
119 | + long pid, int cursig, const void *gregs) | |
120 | +{ | |
7566401a | 121 | + if (gdbarch_ptr_bit (target_gdbarch) == 32) |
3a58abaf AM |
122 | + { |
123 | + char *note_name = "CORE"; | |
124 | + struct elf_prstatus32 prstat; | |
125 | + memset (&prstat, 0, sizeof (prstat)); | |
126 | + prstat.pr_pid = pid; | |
127 | + prstat.pr_cursig = cursig; | |
128 | + amd64_linux_set_registers (gregs, (gdb_byte *) &prstat.pr_reg); | |
129 | + return elfcore_write_note (abfd, buf, bufsiz, note_name, | |
130 | + NT_PRSTATUS, &prstat, sizeof (prstat)); | |
131 | + } | |
132 | + else | |
133 | + return elfcore_write_prstatus (abfd, buf, bufsiz, pid, cursig, gregs); | |
134 | +} | |
135 | + | |
136 | +static char * | |
137 | +amd64_elfcore_write_prxfpreg32 (bfd *abfd, char *buf, int *bufsiz, | |
138 | + struct regcache *regcache) | |
139 | +{ | |
140 | + char *note_name = "LINUX"; | |
141 | + elf_fpxregset32_t fpxregs32; | |
142 | + | |
143 | + i387_collect_fxsave (regcache, -1, &fpxregs32); | |
144 | + return elfcore_write_note(abfd, buf, bufsiz, | |
145 | + note_name, NT_PRXFPREG, &fpxregs32, | |
146 | + sizeof(fpxregs32)); | |
147 | +} | |
148 | + | |
149 | +static char * | |
150 | +amd64_linux_elfcore_write_prfpreg (bfd *abfd, char *buf, | |
151 | + int *bufsiz, const void *fpregs, int size, | |
152 | + struct regcache *regcache) | |
153 | +{ | |
7566401a | 154 | + if (gdbarch_ptr_bit (target_gdbarch) == 32) |
3a58abaf AM |
155 | + { |
156 | + char *note_name = "CORE"; | |
157 | + elf_fpregset32_t fpregs32; | |
158 | + | |
159 | + i387_collect_fsave (regcache, -1, &fpregs32); | |
160 | + buf = elfcore_write_note(abfd, buf, bufsiz, note_name, | |
161 | + NT_FPREGSET, &fpregs32, sizeof(fpregs32)); | |
162 | + | |
163 | + return amd64_elfcore_write_prxfpreg32 (abfd, buf, bufsiz, regcache); | |
164 | + } | |
165 | + else | |
166 | + return elfcore_write_prfpreg (abfd, buf, bufsiz, fpregs, size); | |
167 | +} | |
168 | + | |
169 | + | |
170 | /* Transfering the general-purpose registers between GDB, inferiors | |
171 | and core files. */ | |
172 | ||
7566401a | 173 | @@ -682,6 +804,11 @@ _initialize_amd64_linux_nat (void) |
3a58abaf AM |
174 | t->to_fetch_registers = amd64_linux_fetch_inferior_registers; |
175 | t->to_store_registers = amd64_linux_store_inferior_registers; | |
176 | ||
177 | + /* This functions make elfcore note sections. */ | |
178 | + linux_elfcore_write_prpsinfo = amd64_linux_elfcore_write_prpsinfo; | |
179 | + linux_elfcore_write_prstatus = amd64_linux_elfcore_write_prstatus; | |
180 | + linux_elfcore_write_prfpreg = amd64_linux_elfcore_write_prfpreg; | |
181 | + | |
182 | /* Register the target. */ | |
183 | linux_nat_add_target (t); | |
184 | linux_nat_set_new_thread (t, amd64_linux_new_thread); | |
7566401a | 185 | Index: gdb-6.8.50.20090802/gdb/config.in |
3a58abaf | 186 | =================================================================== |
7566401a ER |
187 | --- gdb-6.8.50.20090802.orig/gdb/config.in 2009-08-03 09:50:57.000000000 +0200 |
188 | +++ gdb-6.8.50.20090802/gdb/config.in 2009-08-03 15:48:31.000000000 +0200 | |
189 | @@ -146,6 +146,9 @@ | |
3a58abaf AM |
190 | /* Define to 1 if you have the <elf_hp.h> header file. */ |
191 | #undef HAVE_ELF_HP_H | |
192 | ||
193 | +/* Define if struct elf_prstatus32 is available. */ | |
194 | +#undef HAVE_ELF_PRSTATUS32 | |
195 | + | |
196 | /* Define to 1 if your system has the etext variable. */ | |
197 | #undef HAVE_ETEXT | |
198 | ||
7566401a | 199 | @@ -487,6 +490,9 @@ |
3a58abaf AM |
200 | /* Define to 1 if you have the <sys/poll.h> header file. */ |
201 | #undef HAVE_SYS_POLL_H | |
202 | ||
203 | +/* Define to 1 if you have the <sys/procfs32.h> header file. */ | |
204 | +#undef HAVE_SYS_PROCFS32_H | |
205 | + | |
206 | /* Define to 1 if you have the <sys/procfs.h> header file. */ | |
207 | #undef HAVE_SYS_PROCFS_H | |
208 | ||
7566401a | 209 | @@ -514,6 +520,9 @@ |
3a58abaf AM |
210 | /* Define to 1 if you have the <sys/types.h> header file. */ |
211 | #undef HAVE_SYS_TYPES_H | |
212 | ||
213 | +/* Define to 1 if you have the <sys/user32.h> header file. */ | |
214 | +#undef HAVE_SYS_USER32_H | |
215 | + | |
216 | /* Define to 1 if you have the <sys/user.h> header file. */ | |
217 | #undef HAVE_SYS_USER_H | |
218 | ||
7566401a | 219 | Index: gdb-6.8.50.20090802/gdb/configure |
3a58abaf | 220 | =================================================================== |
7566401a ER |
221 | --- gdb-6.8.50.20090802.orig/gdb/configure 2009-08-03 09:50:57.000000000 +0200 |
222 | +++ gdb-6.8.50.20090802/gdb/configure 2009-08-03 15:48:31.000000000 +0200 | |
223 | @@ -12545,6 +12545,268 @@ _ACEOF | |
3a58abaf AM |
224 | |
225 | fi | |
226 | ||
227 | + | |
228 | + | |
229 | +for ac_header in sys/user32.h sys/procfs32.h | |
230 | +do | |
231 | +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` | |
232 | +if eval "test \"\${$as_ac_Header+set}\" = set"; then | |
233 | + echo "$as_me:$LINENO: checking for $ac_header" >&5 | |
234 | +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 | |
235 | +if eval "test \"\${$as_ac_Header+set}\" = set"; then | |
236 | + echo $ECHO_N "(cached) $ECHO_C" >&6 | |
237 | +fi | |
238 | +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 | |
239 | +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 | |
240 | +else | |
241 | + # Is the header compilable? | |
242 | +echo "$as_me:$LINENO: checking $ac_header usability" >&5 | |
243 | +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 | |
244 | +cat >conftest.$ac_ext <<_ACEOF | |
245 | +/* confdefs.h. */ | |
246 | +_ACEOF | |
247 | +cat confdefs.h >>conftest.$ac_ext | |
248 | +cat >>conftest.$ac_ext <<_ACEOF | |
249 | +/* end confdefs.h. */ | |
250 | +$ac_includes_default | |
251 | +#include <$ac_header> | |
252 | +_ACEOF | |
253 | +rm -f conftest.$ac_objext | |
254 | +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 | |
255 | + (eval $ac_compile) 2>conftest.er1 | |
256 | + ac_status=$? | |
257 | + grep -v '^ *+' conftest.er1 >conftest.err | |
258 | + rm -f conftest.er1 | |
259 | + cat conftest.err >&5 | |
260 | + echo "$as_me:$LINENO: \$? = $ac_status" >&5 | |
261 | + (exit $ac_status); } && | |
262 | + { ac_try='test -z "$ac_c_werror_flag" | |
263 | + || test ! -s conftest.err' | |
264 | + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 | |
265 | + (eval $ac_try) 2>&5 | |
266 | + ac_status=$? | |
267 | + echo "$as_me:$LINENO: \$? = $ac_status" >&5 | |
268 | + (exit $ac_status); }; } && | |
269 | + { ac_try='test -s conftest.$ac_objext' | |
270 | + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 | |
271 | + (eval $ac_try) 2>&5 | |
272 | + ac_status=$? | |
273 | + echo "$as_me:$LINENO: \$? = $ac_status" >&5 | |
274 | + (exit $ac_status); }; }; then | |
275 | + ac_header_compiler=yes | |
276 | +else | |
277 | + echo "$as_me: failed program was:" >&5 | |
278 | +sed 's/^/| /' conftest.$ac_ext >&5 | |
279 | + | |
280 | +ac_header_compiler=no | |
281 | +fi | |
282 | +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext | |
283 | +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 | |
284 | +echo "${ECHO_T}$ac_header_compiler" >&6 | |
285 | + | |
286 | +# Is the header present? | |
287 | +echo "$as_me:$LINENO: checking $ac_header presence" >&5 | |
288 | +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 | |
289 | +cat >conftest.$ac_ext <<_ACEOF | |
290 | +/* confdefs.h. */ | |
291 | +_ACEOF | |
292 | +cat confdefs.h >>conftest.$ac_ext | |
293 | +cat >>conftest.$ac_ext <<_ACEOF | |
294 | +/* end confdefs.h. */ | |
295 | +#include <$ac_header> | |
296 | +_ACEOF | |
297 | +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 | |
298 | + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 | |
299 | + ac_status=$? | |
300 | + grep -v '^ *+' conftest.er1 >conftest.err | |
301 | + rm -f conftest.er1 | |
302 | + cat conftest.err >&5 | |
303 | + echo "$as_me:$LINENO: \$? = $ac_status" >&5 | |
304 | + (exit $ac_status); } >/dev/null; then | |
305 | + if test -s conftest.err; then | |
306 | + ac_cpp_err=$ac_c_preproc_warn_flag | |
307 | + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag | |
308 | + else | |
309 | + ac_cpp_err= | |
310 | + fi | |
311 | +else | |
312 | + ac_cpp_err=yes | |
313 | +fi | |
314 | +if test -z "$ac_cpp_err"; then | |
315 | + ac_header_preproc=yes | |
316 | +else | |
317 | + echo "$as_me: failed program was:" >&5 | |
318 | +sed 's/^/| /' conftest.$ac_ext >&5 | |
319 | + | |
320 | + ac_header_preproc=no | |
321 | +fi | |
322 | +rm -f conftest.err conftest.$ac_ext | |
323 | +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 | |
324 | +echo "${ECHO_T}$ac_header_preproc" >&6 | |
325 | + | |
326 | +# So? What about this header? | |
327 | +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in | |
328 | + yes:no: ) | |
329 | + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 | |
330 | +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} | |
331 | + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 | |
332 | +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} | |
333 | + ac_header_preproc=yes | |
334 | + ;; | |
335 | + no:yes:* ) | |
336 | + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 | |
337 | +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} | |
338 | + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 | |
339 | +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} | |
340 | + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 | |
341 | +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} | |
342 | + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 | |
343 | +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} | |
344 | + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 | |
345 | +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} | |
346 | + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 | |
347 | +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} | |
348 | + ( | |
349 | + cat <<\_ASBOX | |
350 | +## ------------------------------------------ ## | |
351 | +## Report this to the AC_PACKAGE_NAME lists. ## | |
352 | +## ------------------------------------------ ## | |
353 | +_ASBOX | |
354 | + ) | | |
355 | + sed "s/^/$as_me: WARNING: /" >&2 | |
356 | + ;; | |
357 | +esac | |
358 | +echo "$as_me:$LINENO: checking for $ac_header" >&5 | |
359 | +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 | |
360 | +if eval "test \"\${$as_ac_Header+set}\" = set"; then | |
361 | + echo $ECHO_N "(cached) $ECHO_C" >&6 | |
362 | +else | |
363 | + eval "$as_ac_Header=\$ac_header_preproc" | |
364 | +fi | |
365 | +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 | |
366 | +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 | |
367 | + | |
368 | +fi | |
369 | +if test `eval echo '${'$as_ac_Header'}'` = yes; then | |
370 | + cat >>confdefs.h <<_ACEOF | |
371 | +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 | |
372 | +_ACEOF | |
373 | + | |
374 | +fi | |
375 | + | |
376 | +done | |
377 | + | |
378 | +echo "$as_me:$LINENO: checking for struct elf_prstatus32.pr_reg" >&5 | |
379 | +echo $ECHO_N "checking for struct elf_prstatus32.pr_reg... $ECHO_C" >&6 | |
380 | +if test "${ac_cv_member_struct_elf_prstatus32_pr_reg+set}" = set; then | |
381 | + echo $ECHO_N "(cached) $ECHO_C" >&6 | |
382 | +else | |
383 | + cat >conftest.$ac_ext <<_ACEOF | |
384 | +/* confdefs.h. */ | |
385 | +_ACEOF | |
386 | +cat confdefs.h >>conftest.$ac_ext | |
387 | +cat >>conftest.$ac_ext <<_ACEOF | |
388 | +/* end confdefs.h. */ | |
389 | +#include <sys/procfs.h> | |
390 | + | |
391 | +int | |
392 | +main () | |
393 | +{ | |
394 | +static struct elf_prstatus32 ac_aggr; | |
395 | +if (ac_aggr.pr_reg) | |
396 | +return 0; | |
397 | + ; | |
398 | + return 0; | |
399 | +} | |
400 | +_ACEOF | |
401 | +rm -f conftest.$ac_objext | |
402 | +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 | |
403 | + (eval $ac_compile) 2>conftest.er1 | |
404 | + ac_status=$? | |
405 | + grep -v '^ *+' conftest.er1 >conftest.err | |
406 | + rm -f conftest.er1 | |
407 | + cat conftest.err >&5 | |
408 | + echo "$as_me:$LINENO: \$? = $ac_status" >&5 | |
409 | + (exit $ac_status); } && | |
410 | + { ac_try='test -z "$ac_c_werror_flag" | |
411 | + || test ! -s conftest.err' | |
412 | + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 | |
413 | + (eval $ac_try) 2>&5 | |
414 | + ac_status=$? | |
415 | + echo "$as_me:$LINENO: \$? = $ac_status" >&5 | |
416 | + (exit $ac_status); }; } && | |
417 | + { ac_try='test -s conftest.$ac_objext' | |
418 | + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 | |
419 | + (eval $ac_try) 2>&5 | |
420 | + ac_status=$? | |
421 | + echo "$as_me:$LINENO: \$? = $ac_status" >&5 | |
422 | + (exit $ac_status); }; }; then | |
423 | + ac_cv_member_struct_elf_prstatus32_pr_reg=yes | |
424 | +else | |
425 | + echo "$as_me: failed program was:" >&5 | |
426 | +sed 's/^/| /' conftest.$ac_ext >&5 | |
427 | + | |
428 | +cat >conftest.$ac_ext <<_ACEOF | |
429 | +/* confdefs.h. */ | |
430 | +_ACEOF | |
431 | +cat confdefs.h >>conftest.$ac_ext | |
432 | +cat >>conftest.$ac_ext <<_ACEOF | |
433 | +/* end confdefs.h. */ | |
434 | +#include <sys/procfs.h> | |
435 | + | |
436 | +int | |
437 | +main () | |
438 | +{ | |
439 | +static struct elf_prstatus32 ac_aggr; | |
440 | +if (sizeof ac_aggr.pr_reg) | |
441 | +return 0; | |
442 | + ; | |
443 | + return 0; | |
444 | +} | |
445 | +_ACEOF | |
446 | +rm -f conftest.$ac_objext | |
447 | +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 | |
448 | + (eval $ac_compile) 2>conftest.er1 | |
449 | + ac_status=$? | |
450 | + grep -v '^ *+' conftest.er1 >conftest.err | |
451 | + rm -f conftest.er1 | |
452 | + cat conftest.err >&5 | |
453 | + echo "$as_me:$LINENO: \$? = $ac_status" >&5 | |
454 | + (exit $ac_status); } && | |
455 | + { ac_try='test -z "$ac_c_werror_flag" | |
456 | + || test ! -s conftest.err' | |
457 | + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 | |
458 | + (eval $ac_try) 2>&5 | |
459 | + ac_status=$? | |
460 | + echo "$as_me:$LINENO: \$? = $ac_status" >&5 | |
461 | + (exit $ac_status); }; } && | |
462 | + { ac_try='test -s conftest.$ac_objext' | |
463 | + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 | |
464 | + (eval $ac_try) 2>&5 | |
465 | + ac_status=$? | |
466 | + echo "$as_me:$LINENO: \$? = $ac_status" >&5 | |
467 | + (exit $ac_status); }; }; then | |
468 | + ac_cv_member_struct_elf_prstatus32_pr_reg=yes | |
469 | +else | |
470 | + echo "$as_me: failed program was:" >&5 | |
471 | +sed 's/^/| /' conftest.$ac_ext >&5 | |
472 | + | |
473 | +ac_cv_member_struct_elf_prstatus32_pr_reg=no | |
474 | +fi | |
475 | +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext | |
476 | +fi | |
477 | +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext | |
478 | +fi | |
479 | +echo "$as_me:$LINENO: result: $ac_cv_member_struct_elf_prstatus32_pr_reg" >&5 | |
480 | +echo "${ECHO_T}$ac_cv_member_struct_elf_prstatus32_pr_reg" >&6 | |
481 | +if test $ac_cv_member_struct_elf_prstatus32_pr_reg = yes; then | |
482 | + | |
483 | +cat >>confdefs.h <<\_ACEOF | |
484 | +#define HAVE_ELF_PRSTATUS32 1 | |
485 | +_ACEOF | |
486 | + | |
487 | +fi | |
488 | + | |
489 | # elf_hp.h is for HP/UX 64-bit shared library support. | |
490 | # FIXME: kettenis/20030102: In most cases we include these (ctype.h, time.h) | |
491 | # unconditionally, so what's the point in checking these? | |
7566401a | 492 | Index: gdb-6.8.50.20090802/gdb/configure.ac |
3a58abaf | 493 | =================================================================== |
7566401a ER |
494 | --- gdb-6.8.50.20090802.orig/gdb/configure.ac 2009-08-03 09:50:57.000000000 +0200 |
495 | +++ gdb-6.8.50.20090802/gdb/configure.ac 2009-08-03 15:48:31.000000000 +0200 | |
496 | @@ -744,6 +744,11 @@ AC_SUBST(PYTHON_CFLAGS) | |
3a58abaf AM |
497 | AC_HEADER_DIRENT |
498 | AC_HEADER_STAT | |
499 | AC_HEADER_STDC | |
500 | +AC_CHECK_HEADERS([sys/user32.h sys/procfs32.h]) | |
501 | +AC_CHECK_MEMBER([struct elf_prstatus32.pr_reg], | |
502 | + [AC_DEFINE(HAVE_ELF_PRSTATUS32, 1, | |
503 | + [Define if struct elf_prstatus32 is available. ])], | |
504 | + [], [#include <sys/procfs.h>]) | |
505 | # elf_hp.h is for HP/UX 64-bit shared library support. | |
506 | # FIXME: kettenis/20030102: In most cases we include these (ctype.h, time.h) | |
507 | # unconditionally, so what's the point in checking these? | |
7566401a | 508 | Index: gdb-6.8.50.20090802/gdb/gcore.c |
3a58abaf | 509 | =================================================================== |
7566401a ER |
510 | --- gdb-6.8.50.20090802.orig/gdb/gcore.c 2009-08-03 12:28:56.000000000 +0200 |
511 | +++ gdb-6.8.50.20090802/gdb/gcore.c 2009-08-03 15:48:31.000000000 +0200 | |
512 | @@ -324,6 +324,11 @@ gcore_create_callback (CORE_ADDR vaddr, | |
3a58abaf AM |
513 | asection *osec; |
514 | flagword flags = SEC_ALLOC | SEC_HAS_CONTENTS | SEC_LOAD; | |
515 | ||
516 | + /* Some Linux kernel versions around 2.6.17 have for i386 inferiors running | |
517 | + in compatibility mode on amd64 kernel their VSYSCALL page (at 0xffffe000) | |
518 | + protected as RWX==000 by default and gdb fails to read the library header | |
519 | + upon loading the core. This is a Linux kernel bug being fixed. */ | |
520 | + | |
521 | /* If the memory segment has no permissions set, ignore it, otherwise | |
522 | when we later try to access it for read/write, we'll get an error | |
523 | or jam the kernel. */ | |
7566401a | 524 | Index: gdb-6.8.50.20090802/gdb/gdb_procfs32.h |
3a58abaf AM |
525 | =================================================================== |
526 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | |
7566401a | 527 | +++ gdb-6.8.50.20090802/gdb/gdb_procfs32.h 2009-08-03 15:48:31.000000000 +0200 |
3a58abaf AM |
528 | @@ -0,0 +1,128 @@ |
529 | +#ifdef HAVE_SYS_PROCFS32_H | |
530 | +#include <sys/procfs32.h> | |
531 | +#elif !defined HAVE_ELF_PRSTATUS32 | |
532 | + | |
533 | +/* Copyright (C) 2006 Free Software Foundation, Inc. | |
534 | + This file is part of the GNU C Library. | |
535 | + | |
536 | + The GNU C Library is free software; you can redistribute it and/or | |
537 | + modify it under the terms of the GNU Lesser General Public | |
538 | + License as published by the Free Software Foundation; either | |
539 | + version 2.1 of the License, or (at your option) any later version. | |
540 | + | |
541 | + The GNU C Library is distributed in the hope that it will be useful, | |
542 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | |
543 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
544 | + Lesser General Public License for more details. | |
545 | + | |
546 | + You should have received a copy of the GNU Lesser General Public | |
547 | + License along with the GNU C Library; if not, write to the Free | |
548 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | |
549 | + 02111-1307 USA. */ | |
550 | + | |
551 | +#ifndef _SYS_PROCFS32_H | |
552 | +#define _SYS_PROCFS32_H 1 | |
553 | + | |
554 | +/* This is somewhat modelled after the file of the same name on SVR4 | |
555 | + systems. It provides a definition of the core file format for ELF | |
556 | + used on Linux. It doesn't have anything to do with the /proc file | |
557 | + system, even though Linux has one. | |
558 | + | |
559 | + Anyway, the whole purpose of this file is for GDB and GDB only. | |
560 | + Don't read too much into it. Don't use it for anything other than | |
561 | + GDB unless you know what you are doing. */ | |
562 | + | |
563 | +#include <features.h> | |
564 | +#include <sys/time.h> | |
565 | +#include <sys/types.h> | |
566 | +#include "gdb_user32.h" | |
567 | + | |
568 | +/* We define here only the symbols differing from their 64-bit variant. */ | |
569 | +#include <sys/procfs.h> | |
570 | + | |
571 | +__BEGIN_DECLS | |
572 | + | |
573 | +/* Type for a general-purpose register. */ | |
574 | +typedef unsigned int elf_greg32_t; | |
575 | + | |
576 | +/* And the whole bunch of them. We could have used `struct | |
577 | + user_regs_struct' directly in the typedef, but tradition says that | |
578 | + the register set is an array, which does have some peculiar | |
579 | + semantics, so leave it that way. */ | |
580 | +#define ELF_NGREG32 (sizeof (struct user_regs32_struct) / sizeof(elf_greg32_t)) | |
581 | +typedef elf_greg32_t elf_gregset32_t[ELF_NGREG32]; | |
582 | + | |
583 | +/* Register set for the floating-point registers. */ | |
584 | +typedef struct user_fpregs32_struct elf_fpregset32_t; | |
585 | + | |
586 | +/* Register set for the extended floating-point registers. Includes | |
587 | + the Pentium III SSE registers in addition to the classic | |
588 | + floating-point stuff. */ | |
589 | +typedef struct user_fpxregs32_struct elf_fpxregset32_t; | |
590 | + | |
591 | + | |
592 | +/* Definitions to generate Intel SVR4-like core files. These mostly | |
593 | + have the same names as the SVR4 types with "elf_" tacked on the | |
594 | + front to prevent clashes with Linux definitions, and the typedef | |
595 | + forms have been avoided. This is mostly like the SVR4 structure, | |
596 | + but more Linuxy, with things that Linux does not support and which | |
597 | + GDB doesn't really use excluded. */ | |
598 | + | |
599 | +struct prstatus32_timeval | |
600 | + { | |
601 | + int tv_sec; | |
602 | + int tv_usec; | |
603 | + }; | |
604 | + | |
605 | +struct elf_prstatus32 | |
606 | + { | |
607 | + struct elf_siginfo pr_info; /* Info associated with signal. */ | |
608 | + short int pr_cursig; /* Current signal. */ | |
609 | + unsigned int pr_sigpend; /* Set of pending signals. */ | |
610 | + unsigned int pr_sighold; /* Set of held signals. */ | |
611 | + __pid_t pr_pid; | |
612 | + __pid_t pr_ppid; | |
613 | + __pid_t pr_pgrp; | |
614 | + __pid_t pr_sid; | |
615 | + struct prstatus32_timeval pr_utime; /* User time. */ | |
616 | + struct prstatus32_timeval pr_stime; /* System time. */ | |
617 | + struct prstatus32_timeval pr_cutime; /* Cumulative user time. */ | |
618 | + struct prstatus32_timeval pr_cstime; /* Cumulative system time. */ | |
619 | + elf_gregset32_t pr_reg; /* GP registers. */ | |
620 | + int pr_fpvalid; /* True if math copro being used. */ | |
621 | + }; | |
622 | + | |
623 | + | |
624 | +struct elf_prpsinfo32 | |
625 | + { | |
626 | + char pr_state; /* Numeric process state. */ | |
627 | + char pr_sname; /* Char for pr_state. */ | |
628 | + char pr_zomb; /* Zombie. */ | |
629 | + char pr_nice; /* Nice val. */ | |
630 | + unsigned int pr_flag; /* Flags. */ | |
631 | + unsigned short int pr_uid; | |
632 | + unsigned short int pr_gid; | |
633 | + int pr_pid, pr_ppid, pr_pgrp, pr_sid; | |
634 | + /* Lots missing */ | |
635 | + char pr_fname[16]; /* Filename of executable. */ | |
636 | + char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */ | |
637 | + }; | |
638 | + | |
639 | + | |
640 | +/* The rest of this file provides the types for emulation of the | |
641 | + Solaris <proc_service.h> interfaces that should be implemented by | |
642 | + users of libthread_db. */ | |
643 | + | |
644 | +/* Register sets. Linux has different names. */ | |
645 | +typedef elf_gregset_t prgregset32_t; | |
646 | +typedef elf_fpregset_t prfpregset32_t; | |
647 | + | |
648 | +/* Process status and info. In the end we do provide typedefs for them. */ | |
649 | +typedef struct elf_prstatus32 prstatus32_t; | |
650 | +typedef struct elf_prpsinfo32 prpsinfo32_t; | |
651 | + | |
652 | +__END_DECLS | |
653 | + | |
654 | +#endif /* _SYS_PROCFS32_H */ | |
655 | + | |
656 | +#endif /* HAVE_SYS_PROCFS32_H */ | |
7566401a | 657 | Index: gdb-6.8.50.20090802/gdb/gdb_user32.h |
3a58abaf AM |
658 | =================================================================== |
659 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | |
7566401a | 660 | +++ gdb-6.8.50.20090802/gdb/gdb_user32.h 2009-08-03 15:48:31.000000000 +0200 |
3a58abaf AM |
661 | @@ -0,0 +1,108 @@ |
662 | +#ifdef HAVE_SYS_USER32_H | |
663 | +#include <sys/user32.h> | |
664 | +#else | |
665 | + | |
666 | +#ifdef HAVE_STDINT_H | |
667 | +#include <stdint.h> | |
668 | +typedef int32_t gdb_int32_t; | |
669 | +typedef uint32_t gdb_uint32_t; | |
670 | +#else | |
671 | +typedef signed int gdb_uint32_t; | |
672 | +typedef unsigned int gdb_uint32_t; | |
673 | +#endif | |
674 | + | |
675 | +/* Copyright (C) 2006 Free Software Foundation, Inc. | |
676 | + This file is part of the GNU C Library. | |
677 | + | |
678 | + The GNU C Library is free software; you can redistribute it and/or | |
679 | + modify it under the terms of the GNU Lesser General Public | |
680 | + License as published by the Free Software Foundation; either | |
681 | + version 2.1 of the License, or (at your option) any later version. | |
682 | + | |
683 | + The GNU C Library is distributed in the hope that it will be useful, | |
684 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | |
685 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
686 | + Lesser General Public License for more details. | |
687 | + | |
688 | + You should have received a copy of the GNU Lesser General Public | |
689 | + License along with the GNU C Library; if not, write to the Free | |
690 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | |
691 | + 02111-1307 USA. */ | |
692 | + | |
693 | +#ifndef _SYS_USER32_H | |
694 | +#define _SYS_USER32_H 1 | |
695 | + | |
696 | +/* These are the 32-bit x86 structures. */ | |
697 | + | |
698 | +struct user_fpregs32_struct | |
699 | +{ | |
700 | + int32_t cwd; | |
701 | + int32_t swd; | |
702 | + int32_t twd; | |
703 | + int32_t fip; | |
704 | + int32_t fcs; | |
705 | + int32_t foo; | |
706 | + int32_t fos; | |
707 | + int32_t st_space [20]; | |
708 | +}; | |
709 | + | |
710 | +struct user_fpxregs32_struct | |
711 | +{ | |
712 | + unsigned short int cwd; | |
713 | + unsigned short int swd; | |
714 | + unsigned short int twd; | |
715 | + unsigned short int fop; | |
716 | + int32_t fip; | |
717 | + int32_t fcs; | |
718 | + int32_t foo; | |
719 | + int32_t fos; | |
720 | + int32_t mxcsr; | |
721 | + int32_t reserved; | |
722 | + int32_t st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */ | |
723 | + int32_t xmm_space[32]; /* 8*16 bytes for each XMM-reg = 128 bytes */ | |
724 | + int32_t padding[56]; | |
725 | +}; | |
726 | + | |
727 | +struct user_regs32_struct | |
728 | +{ | |
729 | + int32_t ebx; | |
730 | + int32_t ecx; | |
731 | + int32_t edx; | |
732 | + int32_t esi; | |
733 | + int32_t edi; | |
734 | + int32_t ebp; | |
735 | + int32_t eax; | |
736 | + int32_t xds; | |
737 | + int32_t xes; | |
738 | + int32_t xfs; | |
739 | + int32_t xgs; | |
740 | + int32_t orig_eax; | |
741 | + int32_t eip; | |
742 | + int32_t xcs; | |
743 | + int32_t eflags; | |
744 | + int32_t esp; | |
745 | + int32_t xss; | |
746 | +}; | |
747 | + | |
748 | +struct user32 | |
749 | +{ | |
750 | + struct user_regs32_struct regs; | |
751 | + int u_fpvalid; | |
752 | + struct user_fpregs32_struct i387; | |
753 | + uint32_t u_tsize; | |
754 | + uint32_t u_dsize; | |
755 | + uint32_t u_ssize; | |
756 | + uint32_t start_code; | |
757 | + uint32_t start_stack; | |
758 | + int32_t signal; | |
759 | + int reserved; | |
760 | + struct user_regs32_struct* u_ar0; | |
761 | + struct user_fpregs32_struct* u_fpstate; | |
762 | + uint32_t magic; | |
763 | + char u_comm [32]; | |
764 | + int u_debugreg [8]; | |
765 | +}; | |
766 | + | |
767 | +#endif /* _SYS_USER32_H */ | |
768 | + | |
769 | +#endif /* HAVE_SYS_USER32_H */ | |
7566401a | 770 | Index: gdb-6.8.50.20090802/gdb/linux-nat.c |
3a58abaf | 771 | =================================================================== |
7566401a ER |
772 | --- gdb-6.8.50.20090802.orig/gdb/linux-nat.c 2009-08-03 12:31:26.000000000 +0200 |
773 | +++ gdb-6.8.50.20090802/gdb/linux-nat.c 2009-08-03 15:48:31.000000000 +0200 | |
774 | @@ -219,6 +219,21 @@ static LONGEST (*super_xfer_partial) (st | |
3a58abaf AM |
775 | const gdb_byte *, |
776 | ULONGEST, LONGEST); | |
777 | ||
778 | +/* This functions make elfcore note sections. | |
779 | + They may get overriden by code adjusting data for multi-target builds. */ | |
780 | +char *(*linux_elfcore_write_prpsinfo) | |
781 | + (bfd *, char *, int *, const char *, const char *) = elfcore_write_prpsinfo; | |
782 | +char *(*linux_elfcore_write_prstatus) | |
783 | + (bfd *, char *, int *, long, int, const void *) = elfcore_write_prstatus; | |
784 | +static char * | |
785 | +linux_elfcore_write_prfpreg_bfd (bfd *abfd, char *buf, int *bufsiz, | |
786 | + const void *fpregs, int size, struct regcache *regcache) | |
787 | +{ | |
788 | + return elfcore_write_prfpreg (abfd, buf, bufsiz, fpregs, size); | |
789 | +} | |
790 | +char *(*linux_elfcore_write_prfpreg) (bfd *, char *, int *, const void *, int, | |
791 | + struct regcache *) = linux_elfcore_write_prfpreg_bfd; | |
792 | + | |
793 | static int debug_linux_nat; | |
794 | static void | |
795 | show_debug_linux_nat (struct ui_file *file, int from_tty, | |
7566401a | 796 | @@ -3586,7 +3601,7 @@ linux_nat_do_thread_registers (bfd *obfd |
3a58abaf AM |
797 | else |
798 | fill_gregset (regcache, &gregs, -1); | |
799 | ||
800 | - note_data = (char *) elfcore_write_prstatus (obfd, | |
801 | + note_data = (char *) linux_elfcore_write_prstatus (obfd, | |
802 | note_data, | |
803 | note_size, | |
804 | lwp, | |
7566401a | 805 | @@ -3636,10 +3651,10 @@ linux_nat_do_thread_registers (bfd *obfd |
3a58abaf AM |
806 | else |
807 | fill_fpregset (regcache, &fpregs, -1); | |
808 | ||
809 | - note_data = (char *) elfcore_write_prfpreg (obfd, | |
810 | + note_data = (char *) linux_elfcore_write_prfpreg (obfd, | |
811 | note_data, | |
812 | note_size, | |
813 | - &fpregs, sizeof (fpregs)); | |
814 | + &fpregs, sizeof (fpregs), regcache); | |
815 | } | |
816 | ||
817 | return note_data; | |
7566401a | 818 | @@ -3822,9 +3837,9 @@ linux_nat_make_corefile_notes (bfd *obfd |
3a58abaf AM |
819 | psargs_end - string_end); |
820 | } | |
821 | } | |
822 | - note_data = (char *) elfcore_write_prpsinfo (obfd, | |
823 | - note_data, | |
824 | - note_size, fname, psargs); | |
825 | + note_data = (char *) linux_elfcore_write_prpsinfo (obfd, note_data, | |
826 | + note_size, fname, | |
827 | + psargs); | |
828 | } | |
829 | ||
830 | /* Dump information for threads. */ | |
7566401a | 831 | Index: gdb-6.8.50.20090802/gdb/linux-nat.h |
3a58abaf | 832 | =================================================================== |
7566401a ER |
833 | --- gdb-6.8.50.20090802.orig/gdb/linux-nat.h 2009-08-03 10:52:00.000000000 +0200 |
834 | +++ gdb-6.8.50.20090802/gdb/linux-nat.h 2009-08-03 15:48:31.000000000 +0200 | |
835 | @@ -144,3 +144,12 @@ void linux_nat_switch_fork (ptid_t new_p | |
3a58abaf AM |
836 | |
837 | /* Return the saved siginfo associated with PTID. */ | |
838 | struct siginfo *linux_nat_get_siginfo (ptid_t ptid); | |
839 | + | |
840 | +/* These functions make elfcore note sections. | |
841 | + They may get overriden by code adjusting data for multi-target builds. */ | |
842 | +extern char *(*linux_elfcore_write_prpsinfo) | |
843 | + (bfd *, char *, int *, const char *, const char *); | |
844 | +extern char *(*linux_elfcore_write_prstatus) | |
845 | + (bfd *, char *, int *, long, int, const void *); | |
846 | +extern char *(*linux_elfcore_write_prfpreg) | |
847 | + (bfd *, char *, int *, const void *, int, struct regcache *); |