2006-09-23 Jan Kratochvil * sysdeps/unix/sysv/linux/x86_64/sys/procfs32.h: Define 32-bit core file structures for 32bit inferiors dumped by 64bit GDB. * sysdeps/unix/sysv/linux/x86_64/sys/user32.h: Likewise. * sysdeps/unix/sysv/linux/x86_64/sys/user.h: Simplified by user32.h. * sysdeps/unix/sysv/linux/x86_64/Makefile: Add procfs32.h, user32.h. Index: sysdeps/unix/sysv/linux/x86_64/Makefile =================================================================== RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/x86_64/Makefile,v retrieving revision 1.8 diff -u -p -r1.8 Makefile --- sysdeps/unix/sysv/linux/x86_64/Makefile 22 Dec 2005 04:57:36 -0000 1.8 +++ sysdeps/unix/sysv/linux/x86_64/Makefile 23 Sep 2006 07:53:25 -0000 @@ -3,7 +3,8 @@ ifeq ($(subdir),misc) sysdep_routines += ioperm iopl -sysdep_headers += sys/perm.h sys/reg.h sys/debugreg.h sys/io.h +sysdep_headers += sys/perm.h sys/reg.h sys/debugreg.h sys/io.h \ + sys/user32.h sys/procfs32.h endif ifeq ($(subdir),stdlib) Index: sysdeps/unix/sysv/linux/x86_64/sys/procfs32.h =================================================================== RCS file: sysdeps/unix/sysv/linux/x86_64/sys/procfs32.h diff -N sysdeps/unix/sysv/linux/x86_64/sys/procfs32.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ sysdeps/unix/sysv/linux/x86_64/sys/procfs32.h 23 Sep 2006 07:53:25 -0000 @@ -0,0 +1,122 @@ +/* Copyright (C) 2006 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_PROCFS32_H +#define _SYS_PROCFS32_H 1 + +/* This is somewhat modelled after the file of the same name on SVR4 + systems. It provides a definition of the core file format for ELF + used on Linux. It doesn't have anything to do with the /proc file + system, even though Linux has one. + + Anyway, the whole purpose of this file is for GDB and GDB only. + Don't read too much into it. Don't use it for anything other than + GDB unless you know what you are doing. */ + +#include +#include +#include +#include + +/* We define here only the symbols differing from their 64-bit variant. */ +#include + +__BEGIN_DECLS + +/* Type for a general-purpose register. */ +typedef unsigned int elf_greg32_t; + +/* And the whole bunch of them. We could have used `struct + user_regs_struct' directly in the typedef, but tradition says that + the register set is an array, which does have some peculiar + semantics, so leave it that way. */ +#define ELF_NGREG32 (sizeof (struct user_regs32_struct) / sizeof(elf_greg32_t)) +typedef elf_greg32_t elf_gregset32_t[ELF_NGREG32]; + +/* Register set for the floating-point registers. */ +typedef struct user_fpregs32_struct elf_fpregset32_t; + +/* Register set for the extended floating-point registers. Includes + the Pentium III SSE registers in addition to the classic + floating-point stuff. */ +typedef struct user_fpxregs32_struct elf_fpxregset32_t; + + +/* Definitions to generate Intel SVR4-like core files. These mostly + have the same names as the SVR4 types with "elf_" tacked on the + front to prevent clashes with Linux definitions, and the typedef + forms have been avoided. This is mostly like the SVR4 structure, + but more Linuxy, with things that Linux does not support and which + GDB doesn't really use excluded. */ + +struct prstatus32_timeval + { + int tv_sec; + int tv_usec; + }; + +struct elf_prstatus32 + { + struct elf_siginfo pr_info; /* Info associated with signal. */ + short int pr_cursig; /* Current signal. */ + unsigned int pr_sigpend; /* Set of pending signals. */ + unsigned int pr_sighold; /* Set of held signals. */ + __pid_t pr_pid; + __pid_t pr_ppid; + __pid_t pr_pgrp; + __pid_t pr_sid; + struct prstatus32_timeval pr_utime; /* User time. */ + struct prstatus32_timeval pr_stime; /* System time. */ + struct prstatus32_timeval pr_cutime; /* Cumulative user time. */ + struct prstatus32_timeval pr_cstime; /* Cumulative system time. */ + elf_gregset32_t pr_reg; /* GP registers. */ + int pr_fpvalid; /* True if math copro being used. */ + }; + + +struct elf_prpsinfo32 + { + char pr_state; /* Numeric process state. */ + char pr_sname; /* Char for pr_state. */ + char pr_zomb; /* Zombie. */ + char pr_nice; /* Nice val. */ + unsigned int pr_flag; /* Flags. */ + unsigned short int pr_uid; + unsigned short int pr_gid; + int pr_pid, pr_ppid, pr_pgrp, pr_sid; + /* Lots missing */ + char pr_fname[16]; /* Filename of executable. */ + char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */ + }; + + +/* The rest of this file provides the types for emulation of the + Solaris interfaces that should be implemented by + users of libthread_db. */ + +/* Register sets. Linux has different names. */ +typedef elf_gregset_t prgregset32_t; +typedef elf_fpregset_t prfpregset32_t; + +/* Process status and info. In the end we do provide typedefs for them. */ +typedef struct elf_prstatus32 prstatus32_t; +typedef struct elf_prpsinfo32 prpsinfo32_t; + +__END_DECLS + +#endif /* _SYS_PROCFS32_H */ Index: sysdeps/unix/sysv/linux/x86_64/sys/user.h =================================================================== RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/x86_64/sys/user.h,v retrieving revision 1.5 diff -u -p -r1.5 user.h --- sysdeps/unix/sysv/linux/x86_64/sys/user.h 4 Nov 2004 23:37:34 -0000 1.5 +++ sysdeps/unix/sysv/linux/x86_64/sys/user.h 23 Sep 2006 07:53:25 -0000 @@ -25,7 +25,23 @@ #include -#if __WORDSIZE == 64 +#if __WORDSIZE == 32 + +#include + +/* `user' is too dangerous to keep `#define'd. */ +#define user_fpregs_struct user_fpregs_struct32 +#define user_fpxregs_struct user_fpxregs_struct32 +#define user_regs_struct user_regs_struct32 +#define user user32 +#undef _SYS_USER32_H +#include +#undef user_fpregs_struct +#undef user_fpxregs_struct +#undef user_regs_struct +#undef user + +#elif __WORDSIZE == 64 struct user_fpregs_struct { @@ -93,75 +109,7 @@ struct user }; #else -/* These are the 32-bit x86 structures. */ -struct user_fpregs_struct -{ - long int cwd; - long int swd; - long int twd; - long int fip; - long int fcs; - long int foo; - long int fos; - long int st_space [20]; -}; - -struct user_fpxregs_struct -{ - unsigned short int cwd; - unsigned short int swd; - unsigned short int twd; - unsigned short int fop; - long int fip; - long int fcs; - long int foo; - long int fos; - long int mxcsr; - long int reserved; - long int st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */ - long int xmm_space[32]; /* 8*16 bytes for each XMM-reg = 128 bytes */ - long int padding[56]; -}; - -struct user_regs_struct -{ - long int ebx; - long int ecx; - long int edx; - long int esi; - long int edi; - long int ebp; - long int eax; - long int xds; - long int xes; - long int xfs; - long int xgs; - long int orig_eax; - long int eip; - long int xcs; - long int eflags; - long int esp; - long int xss; -}; - -struct user -{ - struct user_regs_struct regs; - int u_fpvalid; - struct user_fpregs_struct i387; - unsigned long int u_tsize; - unsigned long int u_dsize; - unsigned long int u_ssize; - unsigned long start_code; - unsigned long start_stack; - long int signal; - int reserved; - struct user_regs_struct* u_ar0; - struct user_fpregs_struct* u_fpstate; - unsigned long int magic; - char u_comm [32]; - int u_debugreg [8]; -}; +#error "__WORDSIZE neither 32 nor 64" #endif /* __WORDSIZE */ #define PAGE_SHIFT 12 Index: sysdeps/unix/sysv/linux/x86_64/sys/user32.h =================================================================== RCS file: sysdeps/unix/sysv/linux/x86_64/sys/user32.h diff -N sysdeps/unix/sysv/linux/x86_64/sys/user32.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ sysdeps/unix/sysv/linux/x86_64/sys/user32.h 23 Sep 2006 07:53:25 -0000 @@ -0,0 +1,93 @@ +/* Copyright (C) 2006 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_USER32_H +#define _SYS_USER32_H 1 + +/* These are the 32-bit x86 structures. */ + +struct user_fpregs32_struct +{ + __int32_t cwd; + __int32_t swd; + __int32_t twd; + __int32_t fip; + __int32_t fcs; + __int32_t foo; + __int32_t fos; + __int32_t st_space [20]; +}; + +struct user_fpxregs32_struct +{ + unsigned short int cwd; + unsigned short int swd; + unsigned short int twd; + unsigned short int fop; + __int32_t fip; + __int32_t fcs; + __int32_t foo; + __int32_t fos; + __int32_t mxcsr; + __int32_t reserved; + __int32_t st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */ + __int32_t xmm_space[32]; /* 8*16 bytes for each XMM-reg = 128 bytes */ + __int32_t padding[56]; +}; + +struct user_regs32_struct +{ + __int32_t ebx; + __int32_t ecx; + __int32_t edx; + __int32_t esi; + __int32_t edi; + __int32_t ebp; + __int32_t eax; + __int32_t xds; + __int32_t xes; + __int32_t xfs; + __int32_t xgs; + __int32_t orig_eax; + __int32_t eip; + __int32_t xcs; + __int32_t eflags; + __int32_t esp; + __int32_t xss; +}; + +struct user32 +{ + struct user_regs32_struct regs; + int u_fpvalid; + struct user_fpregs32_struct i387; + __uint32_t u_tsize; + __uint32_t u_dsize; + __uint32_t u_ssize; + __uint32_t start_code; + __uint32_t start_stack; + __int32_t signal; + int reserved; + struct user_regs32_struct* u_ar0; + struct user_fpregs32_struct* u_fpstate; + __uint32_t magic; + char u_comm [32]; + int u_debugreg [8]; +}; + +#endif /* _SYS_USER32_H */