This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: *gregset_t misuse (was Re: S390 GDB patch for Dignus Linux/390 compiler support)
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: Greg Alexander <greg at dignus dot com>
- Cc: gdb-patches at sources dot redhat dot com, David Rivers <rivers at dignus dot com>,barrow_dj at yahoo dot com
- Date: Mon, 18 Mar 2002 11:19:34 -0500
- Subject: Re: *gregset_t misuse (was Re: S390 GDB patch for Dignus Linux/390 compiler support)
- References: <20020315165715.A19306@nevyn.them.org> <200203181558.g2IFwG087850@greg.dignus.com>
On Mon, Mar 18, 2002 at 10:58:16AM -0500, Greg Alexander wrote:
> I'm having a hard time figuring out how exactly the ps_l{get,set}regs()
> and thread_db_{fetch,store}_registers() functions get used, but my
> proposal would be for them to use gdb_gregset_t instead of prgregset_t
> (so that gdb_gregset_t can be defined to a pointer type if necessary --
> prgregset_t is really an arch-specific type and should only be referenced
> inside of arch-aware files). I also propose that fill_gregset() and
No. ps_lgetregs is not a gdb-called function. It's called from
libthread_db.so, which is provided by the system. Its argument must be
a prgregset_t. Therefore prgregset_t must also be a pointer or array type.
> It all comes down to the fact that gdb_gregset_t will probably be typedefed
> to prgregset_t or prgregset_t*, but never both!
Remember what I said? From an i386-linux <sys/procfs.h>:
/* 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_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t))
typedef elf_greg_t elf_gregset_t[ELF_NGREG];
S/390 needs to do the same thing. It's very hard to compensate for an
incorrect prgregset_t, because of some peculiarities in the type system
of C w.r.t. arrays and pointer decay.
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer