Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Willgerodt, Felix" <felix.willgerodt@intel.com>
To: Andrew Burgess <aburgess@redhat.com>,
	"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: RE: [PATCHv4 00/10] x86/Linux Target Description Changes
Date: Thu, 25 Apr 2024 13:35:25 +0000	[thread overview]
Message-ID: <MN2PR11MB45664B4D672489A92A0A3E348E172@MN2PR11MB4566.namprd11.prod.outlook.com> (raw)
In-Reply-To: <cover.1712245988.git.aburgess@redhat.com>

> -----Original Message-----
> From: Andrew Burgess <aburgess@redhat.com>
> Sent: Freitag, 5. April 2024 14:33
> To: gdb-patches@sourceware.org
> Cc: Andrew Burgess <aburgess@redhat.com>
> Subject: [PATCHv4 00/10] x86/Linux Target Description Changes
> 
> In v4:
> 
>   - I tried merging V3, but it turned out I broke pretty much
>     everything that wasn't x86 based when configured with
>     --enable-targets=all,
> 
>   - The problem was a failure to correctly split the shared code
>     between the gdb/arch/ and gdb/nat/ directories, as a consequence,
>     code which is needed on a non x86 based host to support x86 based
>     targets wasn't available to the compilation, and the build failed,
> 
>   - In V4 I've gone through every patch and resplit the code in a way
>     which I now believe is correct, I've done the following tests:
> 
>     + On a non x86 host I've built GDB to support only the current
>     host as a target, to support all targets, and to support x86-64
>     and i386 linux targets,
> 
>     + On an i386 virtual machine I built GDB only for the host as a
>     target, and for all targets.  I regression tested the all targets
>     build for unix, native-gdbserver, and native-extended-gdbserver,
> 
>     + On an x86-64 machine I've built GDB for only the current host as
>     a target, and for all targets.  I regression tested the all targets
>     build for unix, native-gdbserver, and native-extended-gdbserver.
> 
>   - Only patches 6, 8, and 10 require significant review.  All of the
>     other patches are pretty trivial (though reviews always welcome).
> 
>   - I think there's more improvements that can be made to the x86
>     target description creation/lookup/caching.  This series only
>     changes the Linux lookup, and we still cache i386/amd64/x32
>     separately.
> 
>     In the future I think we can merge all x86 target description
>     caching into a single data structure, this would be for all OS
>     variants and all ABI variants.
> 
>     Though making that "grand unification" will certainly require some
>     of the code in this series to change, I think the bulk of it will
>     remain, and trying to do everything in one series is just going to
>     result in an even larger series.  I'd prefer to get these first
>     patches merged, then come back to build on this work once this is
>     merged and we know there's no problems with it.
> 
> In v3:
> 
>   - Rebased.  Nasty merge conflict with 4bb20a6244b7091 which I think
>     I've resolved, but am unable to test.  Reposting so the author of
>     that other commit can validate.
> 
>   - Initial testing looks good.  Full tests are still running.
> 
> In v2:
> 
>   - Rebase to current upstream/master, no merge conflicts,
> 
>   - Retested.
> 
> ---
> 
> Andrew Burgess (10):
>   gdbserver/ipa/x86: remove unneeded declarations
>   gdbserver: convert have_ptrace_getregset to a tribool
>   gdb/x86: move reading of cs and ds state into gdb/nat directory
>   gdbserver/x86: move no-xml code earlier in x86_linux_read_description
>   gdb/gdbserver: share I386_LINUX_XSAVE_XCR0_OFFSET definition
>   gdb/gdbserver: share some code relating to target description creation
>   gdb/arch: assert that X86_XSTATE_MPX is not set for x32
>   gdbserver: update target description creation for x86/linux
>   gdb: move xcr0 == 0 check into i386_linux_core_read_description
>   gdb/gdbserver: share x86/linux tdesc caching
> 
>  gdb/Makefile.in                     |   8 +
>  gdb/amd64-linux-tdep.c              |  32 +---
>  gdb/amd64-linux-tdep.h              |   6 -
>  gdb/arch/amd64-linux-tdesc.c        |  61 +++++++
>  gdb/arch/amd64-linux-tdesc.h        |  30 ++++
>  gdb/arch/amd64.c                    |   8 +-
>  gdb/arch/i386-linux-tdesc.c         |  51 ++++++
>  gdb/arch/i386-linux-tdesc.h         |  29 ++++
>  gdb/arch/x86-linux-tdesc-features.c | 247 ++++++++++++++++++++++++++++
>  gdb/arch/x86-linux-tdesc-features.h |  62 +++++++
>  gdb/arch/x86-linux-tdesc.h          |  37 +++++
>  gdb/configure.nat                   |   8 +-
>  gdb/configure.tgt                   |  11 +-
>  gdb/i386-linux-tdep.c               |  42 ++---
>  gdb/i386-linux-tdep.h               |  23 ---
>  gdb/nat/x86-linux-tdesc.c           | 120 ++++++++++++++
>  gdb/nat/x86-linux-tdesc.h           |  60 +++++++
>  gdb/nat/x86-linux.c                 |  47 ++++++
>  gdb/nat/x86-linux.h                 |  28 ++++
>  gdb/x86-linux-nat.c                 | 123 ++------------
>  gdbserver/configure.srv             |  11 ++
>  gdbserver/linux-amd64-ipa.cc        |  50 ++----
>  gdbserver/linux-arm-low.cc          |   6 +-
>  gdbserver/linux-i386-ipa.cc         |  26 +--
>  gdbserver/linux-low.cc              |   2 +-
>  gdbserver/linux-low.h               |   2 +-
>  gdbserver/linux-x86-low.cc          | 192 +++++++--------------
>  gdbserver/linux-x86-tdesc.cc        | 142 +---------------
>  gdbserver/linux-x86-tdesc.h         |  56 -------
>  gdbsupport/x86-xstate.h             |  20 +++
>  30 files changed, 949 insertions(+), 591 deletions(-)
>  create mode 100644 gdb/arch/amd64-linux-tdesc.c
>  create mode 100644 gdb/arch/amd64-linux-tdesc.h
>  create mode 100644 gdb/arch/i386-linux-tdesc.c
>  create mode 100644 gdb/arch/i386-linux-tdesc.h
>  create mode 100644 gdb/arch/x86-linux-tdesc-features.c
>  create mode 100644 gdb/arch/x86-linux-tdesc-features.h
>  create mode 100644 gdb/arch/x86-linux-tdesc.h
>  create mode 100644 gdb/nat/x86-linux-tdesc.c
>  create mode 100644 gdb/nat/x86-linux-tdesc.h
>  delete mode 100644 gdbserver/linux-x86-tdesc.h
> 
> 
> base-commit: 16810e455feb26ef826a3ed876d6d7e6d24818b0
> --
> 2.25.4


Hi Andrew,

Thanks for doing this, I like what this does.
I am still in the middle of reviewing this. Though in first testing I saw
that I can't build a 32-bit gdbserver on Ubuntu 22.04.
I am building like this: 

export CFLAGS="-g -O0 -m32"
export CXXFLAGS="${CFLAGS} -m32"
export LDFLAGS="-m32"

$src/gdb/configure \                                                            
     --build="x86_64-linux-gnu" \                                                
     --host="i686-linux-gnu" \                                                   
     --disable-gdb

make -s -j$(nproc)  all-gdbserver

Not sure if there is an easier way of doing this, but this works for master.
With your series I see this:

  CXX    nat/x86-linux-tdesc.o
/gdb/gdbserver/../gdb/nat/x86-linux-tdesc.c: In function ?const target_desc*
x86_linux_tdesc_for_tid(int, tribool*, gdb::function_view<void(long long unsigned int)>, const char*, uint64_t*)?:
/gdb/gdbserver/../gdb/nat/x86-linux-tdesc.c:54:7: error: ?have_ptrace_getfpxregs? was not declared in this scope;
did you mean ?have_ptrace_getregset??
   54 |   if (have_ptrace_getfpxregs == -1)
      |       ^~~~~~~~~~~~~~~~~~~~~~
      |       have_ptrace_getregset
/gdb/gdbserver/../gdb/nat/x86-linux-tdesc.c:56:7: error: ?elf_fpxregset_t? was not declared in this scope
   56 |       elf_fpxregset_t fpxregs;
      |       ^~~~~~~~~~~~~~~
In file included from /gdb/gdbserver/../gdb/nat/x86-linux-tdesc.c:29:
/gdb/gdbserver/../gdb/nat/x86-linux-tdesc.c:58:53: error: ?fpxregs? was not declared in this scope
   58 |       if (ptrace (PTRACE_GETFPXREGS, tid, 0, (int) &fpxregs) < 0)
      |                                                     ^~~~~~~
/gdb/gdbserver/../gdb/nat/gdb_ptrace.h:142:57: note: in definition of macro ?ptrace?
  142 |          ptrace ((PTRACE_TYPE_ARG1) request, pid, addr, data)
      |                                                         ^~~~
make[1]: *** [Makefile:577: nat/x86-linux-tdesc.o] Error 1
make: *** [Makefile:13074: install-gdbserver] Error 2

I didn't investigate further yet, sorry.

Regards,
Felix
Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

  parent reply	other threads:[~2024-04-25 13:36 UTC|newest]

Thread overview: 116+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-01 15:28 [PATCH 0/7] " Andrew Burgess
2024-02-01 15:28 ` [PATCH 1/7] gdbserver: convert have_ptrace_getregset to a tribool Andrew Burgess
2024-02-01 15:28 ` [PATCH 2/7] gdb/x86: move reading of cs and ds state into gdb/nat directory Andrew Burgess
2024-02-01 15:28 ` [PATCH 3/7] gdbserver/x86: move no-xml code earlier in x86_linux_read_description Andrew Burgess
2024-02-01 15:28 ` [PATCH 4/7] gdb/gdbserver: share I386_LINUX_XSAVE_XCR0_OFFSET definition Andrew Burgess
2024-02-01 15:28 ` [PATCH 5/7] gdb/gdbserver: share some code relating to target description creation Andrew Burgess
2024-02-01 15:28 ` [PATCH 6/7] gdbserver: update target description creation for x86/linux Andrew Burgess
2024-02-01 15:28 ` [PATCH 7/7] gdb/gdbserver: share x86/linux tdesc caching Andrew Burgess
2024-03-05 17:00 ` [PATCHv2 0/7] x86/Linux Target Description Changes Andrew Burgess
2024-03-05 17:00   ` [PATCHv2 1/7] gdbserver: convert have_ptrace_getregset to a tribool Andrew Burgess
2024-03-05 17:00   ` [PATCHv2 2/7] gdb/x86: move reading of cs and ds state into gdb/nat directory Andrew Burgess
2024-03-05 17:00   ` [PATCHv2 3/7] gdbserver/x86: move no-xml code earlier in x86_linux_read_description Andrew Burgess
2024-03-05 17:00   ` [PATCHv2 4/7] gdb/gdbserver: share I386_LINUX_XSAVE_XCR0_OFFSET definition Andrew Burgess
2024-03-05 17:00   ` [PATCHv2 5/7] gdb/gdbserver: share some code relating to target description creation Andrew Burgess
2024-03-05 17:00   ` [PATCHv2 6/7] gdbserver: update target description creation for x86/linux Andrew Burgess
2024-03-19 16:01     ` John Baldwin
2024-03-19 18:34       ` Andrew Burgess
2024-03-21 17:28         ` John Baldwin
2024-03-26 10:01           ` Luis Machado
2024-03-26 15:31             ` Tom Tromey
2024-03-05 17:00   ` [PATCHv2 7/7] gdb/gdbserver: share x86/linux tdesc caching Andrew Burgess
2024-03-19 16:05   ` [PATCHv2 0/7] x86/Linux Target Description Changes John Baldwin
2024-03-23 16:35   ` [PATCHv3 0/8] " Andrew Burgess
2024-03-23 16:35     ` [PATCHv3 1/8] gdbserver: convert have_ptrace_getregset to a tribool Andrew Burgess
2024-03-23 16:35     ` [PATCHv3 2/8] gdb/x86: move reading of cs and ds state into gdb/nat directory Andrew Burgess
2024-03-23 16:35     ` [PATCHv3 3/8] gdbserver/x86: move no-xml code earlier in x86_linux_read_description Andrew Burgess
2024-03-23 16:35     ` [PATCHv3 4/8] gdb/gdbserver: share I386_LINUX_XSAVE_XCR0_OFFSET definition Andrew Burgess
2024-03-23 16:35     ` [PATCHv3 5/8] gdb/gdbserver: share some code relating to target description creation Andrew Burgess
2024-03-23 16:35     ` [PATCHv3 6/8] gdb/arch: assert that X86_XSTATE_MPX is not set for x32 Andrew Burgess
2024-03-23 16:35     ` [PATCHv3 7/8] gdbserver: update target description creation for x86/linux Andrew Burgess
2024-03-23 16:35     ` [PATCHv3 8/8] gdb/gdbserver: share x86/linux tdesc caching Andrew Burgess
2024-03-26 12:17       ` Andrew Burgess
2024-03-25 17:20     ` [PATCHv3 0/8] x86/Linux Target Description Changes Andrew Burgess
2024-03-25 18:26       ` Simon Marchi
2024-03-26 12:15         ` Andrew Burgess
2024-03-26 13:51           ` H.J. Lu
2024-03-26 14:16             ` H.J. Lu
2024-03-26 16:36       ` Andrew Burgess
2024-03-26 19:03         ` Andrew Burgess
2024-04-05 12:33     ` [PATCHv4 00/10] " Andrew Burgess
2024-04-05 12:33       ` [PATCHv4 01/10] gdbserver/ipa/x86: remove unneeded declarations Andrew Burgess
2024-04-05 12:33       ` [PATCHv4 02/10] gdbserver: convert have_ptrace_getregset to a tribool Andrew Burgess
2024-04-05 12:33       ` [PATCHv4 03/10] gdb/x86: move reading of cs and ds state into gdb/nat directory Andrew Burgess
2024-04-05 12:33       ` [PATCHv4 04/10] gdbserver/x86: move no-xml code earlier in x86_linux_read_description Andrew Burgess
2024-04-05 12:33       ` [PATCHv4 05/10] gdb/gdbserver: share I386_LINUX_XSAVE_XCR0_OFFSET definition Andrew Burgess
2024-04-05 12:33       ` [PATCHv4 06/10] gdb/gdbserver: share some code relating to target description creation Andrew Burgess
2024-04-05 12:33       ` [PATCHv4 07/10] gdb/arch: assert that X86_XSTATE_MPX is not set for x32 Andrew Burgess
2024-04-05 12:33       ` [PATCHv4 08/10] gdbserver: update target description creation for x86/linux Andrew Burgess
2024-04-05 12:33       ` [PATCHv4 09/10] gdb: move xcr0 == 0 check into i386_linux_core_read_description Andrew Burgess
2024-04-05 12:33       ` [PATCHv4 10/10] gdb/gdbserver: share x86/linux tdesc caching Andrew Burgess
2024-04-09 18:37       ` [PATCHv4 00/10] x86/Linux Target Description Changes John Baldwin
2024-04-25 13:35       ` Willgerodt, Felix [this message]
2024-04-25 16:06         ` Andrew Burgess
2024-04-26 15:01       ` [PATCHv5 00/11] " Andrew Burgess
2024-04-26 15:01         ` [PATCHv5 01/11] gdbserver/ipa/x86: remove unneeded declarations Andrew Burgess
2024-04-29 14:34           ` Willgerodt, Felix
2024-05-07 15:05             ` Andrew Burgess
2024-05-08  7:49               ` Willgerodt, Felix
2024-04-26 15:01         ` [PATCHv5 02/11] gdbserver: convert have_ptrace_getregset to a tribool Andrew Burgess
2024-04-29 14:34           ` Willgerodt, Felix
2024-05-07 15:28             ` Andrew Burgess
2024-04-26 15:01         ` [PATCHv5 03/11] gdb/x86: move reading of cs and ds state into gdb/nat directory Andrew Burgess
2024-04-29 14:34           ` Willgerodt, Felix
2024-04-26 15:01         ` [PATCHv5 04/11] gdb/x86: move have_ptrace_getfpxregs global " Andrew Burgess
2024-04-29 14:34           ` Willgerodt, Felix
2024-04-26 15:01         ` [PATCHv5 05/11] gdbserver/x86: move no-xml code earlier in x86_linux_read_description Andrew Burgess
2024-04-29 14:34           ` Willgerodt, Felix
2024-05-07 11:55             ` Luis Machado
2024-05-07 15:43               ` Andrew Burgess
2024-05-07 15:56                 ` Luis Machado
2024-05-08  7:49                 ` Willgerodt, Felix
2024-05-08 13:18                   ` Andrew Burgess
2024-04-26 15:01         ` [PATCHv5 06/11] gdb/gdbserver: share I386_LINUX_XSAVE_XCR0_OFFSET definition Andrew Burgess
2024-04-29 14:34           ` Willgerodt, Felix
2024-04-26 15:01         ` [PATCHv5 07/11] gdb/gdbserver: share some code relating to target description creation Andrew Burgess
2024-04-29 14:34           ` Willgerodt, Felix
2024-05-07 11:40             ` Andrew Burgess
2024-04-26 15:01         ` [PATCHv5 08/11] gdb/arch: assert that X86_XSTATE_MPX is not set for x32 Andrew Burgess
2024-04-29 14:34           ` Willgerodt, Felix
2024-05-07 16:08             ` Andrew Burgess
2024-04-26 15:01         ` [PATCHv5 09/11] gdbserver: update target description creation for x86/linux Andrew Burgess
2024-04-29 14:35           ` Willgerodt, Felix
2024-05-07 14:24             ` Andrew Burgess
2024-05-08  7:47               ` Willgerodt, Felix
2024-05-08 13:28                 ` Andrew Burgess
2024-04-26 15:01         ` [PATCHv5 10/11] gdb: move xcr0 == 0 check into i386_linux_core_read_description Andrew Burgess
2024-04-29 14:35           ` Willgerodt, Felix
2024-04-26 15:01         ` [PATCHv5 11/11] gdb/gdbserver: share x86/linux tdesc caching Andrew Burgess
2024-04-29 14:35           ` Willgerodt, Felix
2024-05-07 14:50             ` Andrew Burgess
2024-05-08  7:49               ` Willgerodt, Felix
2024-05-08 16:09                 ` Andrew Burgess
2024-05-08 16:46         ` [PATCHv6 0/9] x86/Linux Target Description Changes Andrew Burgess
2024-05-08 16:46           ` [PATCHv6 1/9] gdb/gdbserver: share I386_LINUX_XSAVE_XCR0_OFFSET definition Andrew Burgess
2024-05-08 16:46           ` [PATCHv6 2/9] gdbserver/x86: move no-xml code earlier in x86_linux_read_description Andrew Burgess
2024-05-08 16:46           ` [PATCHv6 3/9] gdb/x86: move have_ptrace_getfpxregs global into gdb/nat directory Andrew Burgess
2024-05-08 22:52             ` John Baldwin
2024-05-08 16:46           ` [PATCHv6 4/9] gdb/x86: move have_ptrace_getregset " Andrew Burgess
2024-05-08 22:53             ` John Baldwin
2024-05-08 16:46           ` [PATCHv6 5/9] gdb/x86: move reading of cs and ds state " Andrew Burgess
2024-05-08 16:46           ` [PATCHv6 6/9] gdb: move xcr0 == 0 check into i386_linux_core_read_description Andrew Burgess
2024-05-08 22:54             ` John Baldwin
2024-05-08 16:46           ` [PATCHv6 7/9] gdb/gdbserver: share some code relating to target description creation Andrew Burgess
2024-05-08 22:58             ` John Baldwin
2024-05-08 16:46           ` [PATCHv6 8/9] gdbserver: update target description creation for x86/linux Andrew Burgess
2024-05-08 16:46           ` [PATCHv6 9/9] gdb/gdbserver: share x86/linux tdesc caching Andrew Burgess
2024-05-11 10:08           ` [PATCHv7 0/9] x86/Linux Target Description Changes Andrew Burgess
2024-05-11 10:08             ` [PATCHv7 1/9] gdb/gdbserver: share I386_LINUX_XSAVE_XCR0_OFFSET definition Andrew Burgess
2024-05-11 10:08             ` [PATCHv7 2/9] gdbserver/x86: move no-xml code earlier in x86_linux_read_description Andrew Burgess
2024-05-11 10:08             ` [PATCHv7 3/9] gdb/x86: move have_ptrace_getfpxregs global into gdb/nat directory Andrew Burgess
2024-05-11 10:08             ` [PATCHv7 4/9] gdb: move have_ptrace_getregset declaration " Andrew Burgess
2024-05-11 10:08             ` [PATCHv7 5/9] gdb/x86: move reading of cs and ds state " Andrew Burgess
2024-05-11 10:08             ` [PATCHv7 6/9] gdb: move xcr0 == 0 check into i386_linux_core_read_description Andrew Burgess
2024-05-11 10:08             ` [PATCHv7 7/9] gdb/gdbserver: share some code relating to target description creation Andrew Burgess
2024-05-11 10:08             ` [PATCHv7 8/9] gdbserver: update target description creation for x86/linux Andrew Burgess
2024-05-11 10:08             ` [PATCHv7 9/9] gdb/gdbserver: share x86/linux tdesc caching Andrew Burgess

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=MN2PR11MB45664B4D672489A92A0A3E348E172@MN2PR11MB4566.namprd11.prod.outlook.com \
    --to=felix.willgerodt@intel.com \
    --cc=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox