1 2006-10-01 Jan Kratochvil <jan.kratochvil@redhat.com>
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.
18 2007-10-16 Jan Kratochvil <jan.kratochvil@redhat.com>
22 2008-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>
26 Index: gdb-6.8.50.20090802/gdb/amd64-linux-nat.c
27 ===================================================================
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
31 #include "i386-linux-tdep.h"
32 #include "amd64-nat.h"
34 +#include "i387-tdep.h"
36 +#include "gdb_procfs32.h"
38 /* Mapping between the general-purpose registers in GNU/Linux x86-64
39 `struct user' format and GDB's register cache layout. */
40 @@ -85,6 +88,35 @@ static int amd64_linux_gregset64_reg_off
41 GNU/Linux i386 registers are all 32-bit, but since we're
42 little-endian we get away with that. */
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[] =
59 + 14 * 4, /* %eflags */
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,
70 + 11 * 4 /* "orig_eax" */
73 /* From <sys/reg.h> on GNU/Linux i386. */
74 static int amd64_linux_gregset32_reg_offset[] =
76 @@ -103,6 +135,96 @@ static int amd64_linux_gregset32_reg_off
80 +/* This functions make ELF32 32-bit elfcore note sections
81 + on amd64 environment. */
84 +amd64_linux_elfcore_write_prpsinfo (bfd *abfd, char *buf, int *bufsiz,
85 + const char *fname, const char *psargs)
87 + if (gdbarch_ptr_bit (target_gdbarch) == 32)
90 + char *note_name = "CORE";
91 + struct elf_prpsinfo32 data;
92 + note_type = NT_PRPSINFO;
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));
101 + return elfcore_write_prpsinfo (abfd, buf, bufsiz, fname, psargs);
105 +amd64_linux_set_registers (const gdb_byte *gregs, gdb_byte *buf)
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);
118 +amd64_linux_elfcore_write_prstatus (bfd *abfd, char *buf, int *bufsiz,
119 + long pid, int cursig, const void *gregs)
121 + if (gdbarch_ptr_bit (target_gdbarch) == 32)
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));
133 + return elfcore_write_prstatus (abfd, buf, bufsiz, pid, cursig, gregs);
137 +amd64_elfcore_write_prxfpreg32 (bfd *abfd, char *buf, int *bufsiz,
138 + struct regcache *regcache)
140 + char *note_name = "LINUX";
141 + elf_fpxregset32_t fpxregs32;
143 + i387_collect_fxsave (regcache, -1, &fpxregs32);
144 + return elfcore_write_note(abfd, buf, bufsiz,
145 + note_name, NT_PRXFPREG, &fpxregs32,
146 + sizeof(fpxregs32));
150 +amd64_linux_elfcore_write_prfpreg (bfd *abfd, char *buf,
151 + int *bufsiz, const void *fpregs, int size,
152 + struct regcache *regcache)
154 + if (gdbarch_ptr_bit (target_gdbarch) == 32)
156 + char *note_name = "CORE";
157 + elf_fpregset32_t fpregs32;
159 + i387_collect_fsave (regcache, -1, &fpregs32);
160 + buf = elfcore_write_note(abfd, buf, bufsiz, note_name,
161 + NT_FPREGSET, &fpregs32, sizeof(fpregs32));
163 + return amd64_elfcore_write_prxfpreg32 (abfd, buf, bufsiz, regcache);
166 + return elfcore_write_prfpreg (abfd, buf, bufsiz, fpregs, size);
170 /* Transfering the general-purpose registers between GDB, inferiors
173 @@ -682,6 +804,11 @@ _initialize_amd64_linux_nat (void)
174 t->to_fetch_registers = amd64_linux_fetch_inferior_registers;
175 t->to_store_registers = amd64_linux_store_inferior_registers;
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;
182 /* Register the target. */
183 linux_nat_add_target (t);
184 linux_nat_set_new_thread (t, amd64_linux_new_thread);
185 Index: gdb-6.8.50.20090802/gdb/config.in
186 ===================================================================
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
190 /* Define to 1 if you have the <elf_hp.h> header file. */
193 +/* Define if struct elf_prstatus32 is available. */
194 +#undef HAVE_ELF_PRSTATUS32
196 /* Define to 1 if your system has the etext variable. */
200 /* Define to 1 if you have the <sys/poll.h> header file. */
201 #undef HAVE_SYS_POLL_H
203 +/* Define to 1 if you have the <sys/procfs32.h> header file. */
204 +#undef HAVE_SYS_PROCFS32_H
206 /* Define to 1 if you have the <sys/procfs.h> header file. */
207 #undef HAVE_SYS_PROCFS_H
210 /* Define to 1 if you have the <sys/types.h> header file. */
211 #undef HAVE_SYS_TYPES_H
213 +/* Define to 1 if you have the <sys/user32.h> header file. */
214 +#undef HAVE_SYS_USER32_H
216 /* Define to 1 if you have the <sys/user.h> header file. */
217 #undef HAVE_SYS_USER_H
219 Index: gdb-6.8.50.20090802/gdb/configure
220 ===================================================================
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
229 +for ac_header in sys/user32.h sys/procfs32.h
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
238 +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
239 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
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
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>
253 +rm -f conftest.$ac_objext
254 +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
255 + (eval $ac_compile) 2>conftest.er1
257 + grep -v '^ *+' conftest.er1 >conftest.err
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
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
273 + echo "$as_me:$LINENO: \$? = $ac_status" >&5
274 + (exit $ac_status); }; }; then
275 + ac_header_compiler=yes
277 + echo "$as_me: failed program was:" >&5
278 +sed 's/^/| /' conftest.$ac_ext >&5
280 +ac_header_compiler=no
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
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
292 +cat confdefs.h >>conftest.$ac_ext
293 +cat >>conftest.$ac_ext <<_ACEOF
294 +/* end confdefs.h. */
295 +#include <$ac_header>
297 +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
298 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
300 + grep -v '^ *+' conftest.er1 >conftest.err
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
314 +if test -z "$ac_cpp_err"; then
315 + ac_header_preproc=yes
317 + echo "$as_me: failed program was:" >&5
318 +sed 's/^/| /' conftest.$ac_ext >&5
320 + ac_header_preproc=no
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
326 +# So? What about this header?
327 +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
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
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;}
350 +## ------------------------------------------ ##
351 +## Report this to the AC_PACKAGE_NAME lists. ##
352 +## ------------------------------------------ ##
355 + sed "s/^/$as_me: WARNING: /" >&2
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
363 + eval "$as_ac_Header=\$ac_header_preproc"
365 +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
366 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
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
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
383 + cat >conftest.$ac_ext <<_ACEOF
386 +cat confdefs.h >>conftest.$ac_ext
387 +cat >>conftest.$ac_ext <<_ACEOF
388 +/* end confdefs.h. */
389 +#include <sys/procfs.h>
394 +static struct elf_prstatus32 ac_aggr;
401 +rm -f conftest.$ac_objext
402 +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
403 + (eval $ac_compile) 2>conftest.er1
405 + grep -v '^ *+' conftest.er1 >conftest.err
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
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
421 + echo "$as_me:$LINENO: \$? = $ac_status" >&5
422 + (exit $ac_status); }; }; then
423 + ac_cv_member_struct_elf_prstatus32_pr_reg=yes
425 + echo "$as_me: failed program was:" >&5
426 +sed 's/^/| /' conftest.$ac_ext >&5
428 +cat >conftest.$ac_ext <<_ACEOF
431 +cat confdefs.h >>conftest.$ac_ext
432 +cat >>conftest.$ac_ext <<_ACEOF
433 +/* end confdefs.h. */
434 +#include <sys/procfs.h>
439 +static struct elf_prstatus32 ac_aggr;
440 +if (sizeof ac_aggr.pr_reg)
446 +rm -f conftest.$ac_objext
447 +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
448 + (eval $ac_compile) 2>conftest.er1
450 + grep -v '^ *+' conftest.er1 >conftest.err
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
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
466 + echo "$as_me:$LINENO: \$? = $ac_status" >&5
467 + (exit $ac_status); }; }; then
468 + ac_cv_member_struct_elf_prstatus32_pr_reg=yes
470 + echo "$as_me: failed program was:" >&5
471 +sed 's/^/| /' conftest.$ac_ext >&5
473 +ac_cv_member_struct_elf_prstatus32_pr_reg=no
475 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
477 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
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
483 +cat >>confdefs.h <<\_ACEOF
484 +#define HAVE_ELF_PRSTATUS32 1
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?
492 Index: gdb-6.8.50.20090802/gdb/configure.ac
493 ===================================================================
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)
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?
508 Index: gdb-6.8.50.20090802/gdb/gcore.c
509 ===================================================================
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,
514 flagword flags = SEC_ALLOC | SEC_HAS_CONTENTS | SEC_LOAD;
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. */
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. */
524 Index: gdb-6.8.50.20090802/gdb/gdb_procfs32.h
525 ===================================================================
526 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
527 +++ gdb-6.8.50.20090802/gdb/gdb_procfs32.h 2009-08-03 15:48:31.000000000 +0200
529 +#ifdef HAVE_SYS_PROCFS32_H
530 +#include <sys/procfs32.h>
531 +#elif !defined HAVE_ELF_PRSTATUS32
533 +/* Copyright (C) 2006 Free Software Foundation, Inc.
534 + This file is part of the GNU C Library.
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.
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.
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
551 +#ifndef _SYS_PROCFS32_H
552 +#define _SYS_PROCFS32_H 1
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.
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. */
563 +#include <features.h>
564 +#include <sys/time.h>
565 +#include <sys/types.h>
566 +#include "gdb_user32.h"
568 +/* We define here only the symbols differing from their 64-bit variant. */
569 +#include <sys/procfs.h>
573 +/* Type for a general-purpose register. */
574 +typedef unsigned int elf_greg32_t;
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];
583 +/* Register set for the floating-point registers. */
584 +typedef struct user_fpregs32_struct elf_fpregset32_t;
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;
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. */
599 +struct prstatus32_timeval
605 +struct elf_prstatus32
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. */
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. */
624 +struct elf_prpsinfo32
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;
635 + char pr_fname[16]; /* Filename of executable. */
636 + char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */
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. */
644 +/* Register sets. Linux has different names. */
645 +typedef elf_gregset_t prgregset32_t;
646 +typedef elf_fpregset_t prfpregset32_t;
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;
654 +#endif /* _SYS_PROCFS32_H */
656 +#endif /* HAVE_SYS_PROCFS32_H */
657 Index: gdb-6.8.50.20090802/gdb/gdb_user32.h
658 ===================================================================
659 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
660 +++ gdb-6.8.50.20090802/gdb/gdb_user32.h 2009-08-03 15:48:31.000000000 +0200
662 +#ifdef HAVE_SYS_USER32_H
663 +#include <sys/user32.h>
666 +#ifdef HAVE_STDINT_H
668 +typedef int32_t gdb_int32_t;
669 +typedef uint32_t gdb_uint32_t;
671 +typedef signed int gdb_uint32_t;
672 +typedef unsigned int gdb_uint32_t;
675 +/* Copyright (C) 2006 Free Software Foundation, Inc.
676 + This file is part of the GNU C Library.
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.
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.
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
693 +#ifndef _SYS_USER32_H
694 +#define _SYS_USER32_H 1
696 +/* These are the 32-bit x86 structures. */
698 +struct user_fpregs32_struct
707 + int32_t st_space [20];
710 +struct user_fpxregs32_struct
712 + unsigned short int cwd;
713 + unsigned short int swd;
714 + unsigned short int twd;
715 + unsigned short int fop;
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];
727 +struct user_regs32_struct
750 + struct user_regs32_struct regs;
752 + struct user_fpregs32_struct i387;
756 + uint32_t start_code;
757 + uint32_t start_stack;
760 + struct user_regs32_struct* u_ar0;
761 + struct user_fpregs32_struct* u_fpstate;
764 + int u_debugreg [8];
767 +#endif /* _SYS_USER32_H */
769 +#endif /* HAVE_SYS_USER32_H */
770 Index: gdb-6.8.50.20090802/gdb/linux-nat.c
771 ===================================================================
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
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;
785 +linux_elfcore_write_prfpreg_bfd (bfd *abfd, char *buf, int *bufsiz,
786 + const void *fpregs, int size, struct regcache *regcache)
788 + return elfcore_write_prfpreg (abfd, buf, bufsiz, fpregs, size);
790 +char *(*linux_elfcore_write_prfpreg) (bfd *, char *, int *, const void *, int,
791 + struct regcache *) = linux_elfcore_write_prfpreg_bfd;
793 static int debug_linux_nat;
795 show_debug_linux_nat (struct ui_file *file, int from_tty,
796 @@ -3586,7 +3601,7 @@ linux_nat_do_thread_registers (bfd *obfd
798 fill_gregset (regcache, &gregs, -1);
800 - note_data = (char *) elfcore_write_prstatus (obfd,
801 + note_data = (char *) linux_elfcore_write_prstatus (obfd,
805 @@ -3636,10 +3651,10 @@ linux_nat_do_thread_registers (bfd *obfd
807 fill_fpregset (regcache, &fpregs, -1);
809 - note_data = (char *) elfcore_write_prfpreg (obfd,
810 + note_data = (char *) linux_elfcore_write_prfpreg (obfd,
813 - &fpregs, sizeof (fpregs));
814 + &fpregs, sizeof (fpregs), regcache);
818 @@ -3822,9 +3837,9 @@ linux_nat_make_corefile_notes (bfd *obfd
819 psargs_end - string_end);
822 - note_data = (char *) elfcore_write_prpsinfo (obfd,
824 - note_size, fname, psargs);
825 + note_data = (char *) linux_elfcore_write_prpsinfo (obfd, note_data,
830 /* Dump information for threads. */
831 Index: gdb-6.8.50.20090802/gdb/linux-nat.h
832 ===================================================================
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
837 /* Return the saved siginfo associated with PTID. */
838 struct siginfo *linux_nat_get_siginfo (ptid_t ptid);
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 *);