Re: S390 GDB patch for Dignus Linux/390 compiler support

Daniel Jacobowitz
2002-03-15T21:57:30Z

No comment on the rest, but...

On Fri, Mar 15, 2002 at 04:11:42PM -0500, Greg Alexander wrote:
>
> There is another issue which concerns me, though, when it comes to
> S390 support. The 5.1.1 sources did not compile for S390
> straight out of the box. There were four similar cases where I
> had to add an ampersand:
> proc-service.c:236 (in ps_lgetregs)
> proc-service.c:253 (in ps_lsetregs)
> thread-db.c:804 (in thread_db_fetch_registers)
> thread-db.c:837 (in thread_db_store_registers)
>
> These are all calls to fill_gregset() or supply_gregset():
> fill_gregset ((gdb_gregset_t *) gregset, -1);
> supply_gregset ((gdb_gregset_t *) gregset);
>
> It turns out, tracing back all the typedefs, that this cast is wrong.
> gregset is of type gdb_gregset_t, so casting it to gdb_gregset_t*
> doesn't make much sense. On the platforms I checked (except S390)
> the first thing these functions do is take their argument and cast
> it back to gdb_gregset_t. So overall it has no effect on the code,
> because gdb_gregset_t is, on most platforms, already a pointer type.
> However, on S390, gdb_gregset_t is a structure type, and the
> fill_gregset() and supply_gregset() (s390-nat.c) functions expect
> a pointer to the structure. The really easy/hacky fix is to add

This is a nonconformance in Linux for the S/390 then. gdb_gregset_t is
an elf_gregset_t on Linux, which -must- be an array type. If it is a
structure, that should be fixed - or at least you should hide it for
GDB by defining GDB_GREGSET_T to an appropriate-size array.

--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer