[PATCH 04/15 v2] Introduce common-types.h

Doug Evans dje@google.com
Thu Jul 17 11:21:00 GMT 2014

On Wed, Jul 16, 2014 at 7:17 AM, Gary Benson <gbenson@redhat.com> wrote:
> This introduces common-types.h.  This file defines various standard
> types used by gdb and gdbserver.
> Currently these types are conditionally defined based on GDBSERVER.
> The long term goal is to remove all such tests; however, this is
> difficult as currently gdb uses definitions from BFD.  In the meantime
> this is still a step in the right direction.
> gdb/
> 2014-07-16  Tom Tromey  <tromey@redhat.com>
>             Gary Benson  <gbenson@redhat.com>
>         * common/common-types.h: New file.
>         * nat/linux-ptrace.c: Include common-types.h.
>         * defs.h: Include common-types.h.
>         (gdb_byte, CORE_ADDR, CORE_ADDR_MAX, LONGEST, ULONGEST): Remove.
> gdb/gdbserver/
> 2014-07-16  Tom Tromey  <tromey@redhat.com>
>         * server.h: Include common-types.h.  Move gdb_assert.h include
>         earlier.  Add static assertion.
>         (gdb_byte, CORE_ADDR, LONGEST, ULONGEST): Remove.


One nit for discussion's sake.
CORE_ADDR for gdbserver is a native value, whereas in gdb it's a
target value.  That's why the static assert (sizeof (CORE_ADDR) >=
sizeof (void *)) isn't in common code (IIUC - e.g., consider a
64-cross-32 gdb).  I don't think that'll ever be a problem, and if it
does become one we can address it then.  Just thinking out loud ...

More information about the Gdb-patches mailing list