This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC 0/7] Make GDB builtin target descriptions more flexible


This patch series is to change GDB builtin target descriptions more
flexible, by removing pre-generated ones.  Instead, these builtin
target descriptions can be got lazily and dynamically.  GDB builtin
target descriptions are created from initialize_tdesc_* functions in
features/*.c files.  This patch series demonstrate what does target
descriptions look like by only touching i386-linux target descriptions.

There are some shortcoming in GDB target description,

  1) All builtin target descriptions are pre-defined.  Since all GDB
  target descriptions are pre-defined, it is not flexible to compose
  features for different target descriptions.  Suppose, some architecture
  has three hardware features (like avx or mpx in x86), A, B, and C.  B
  and C can be optional.  During to the current GDB target description
  limitation, we need to define four target descriptions A, A-B, A-C,
  A-B-C.  If we need to add a new optional feature D, we need to double
  target descriptions.

  2) Target feature is not parameterized.  Registers in the same target
  feature may have different register sizes in different target descriptions.
  For example, the register size in "org.gnu.gdb.power.core" and
  "org.gnu.gdb.mips.cpu" varies between 32-bit variant and 64-bit variant.
  As a result, there are two xml files for the same feature respectively.

Only 1) is addressed in this patch series for i386-linux target.  If
people like what this patch series does, I'll gradually change other
target descriptions to the new style.  That is why I post this RFC.
GDBserver target description needs change as well, to make it more
flexible too, but GDBserver changes can be independent with GDB
changes, as long as the basic xml format is not changed.

Patch 1 is to move mips target descriptions from -nat.c to -tdep.c,
so that I can test them on x86_64-linux.  I've posted it separately
https://sourceware.org/ml/gdb-patches/2017-05/msg00204.html, include
it here to give more context.

Patch 2 adds a good unit test to verify we can get the same target
description from both xml files and c files.  It makes sure my following
changes don't break anything on target descriptions, but it, as a
unit test case, can go in independently.

Patch 4 is the major part of this series, and the following patches
changes i386-linux target descriptions, which become more flexible,
so that we can compose these target features in a free way.

Regression tested on x86_64-linux{-m32,-m64} and ppc64-linux.

*** BLURB HERE ***

Yao Qi (7):
  Move initialize_tdesc_mips* calls from mips-linux-nat.c to
    mips-linux-tdep.c
  Add unit test to builtin tdesc generated by xml
  Adjust the order of 32bit-linux.xml and 32bit-sse.xml in
    i386/i386-linux.xml
  Share code in initialize_tdesc_ functions
  Centralize i386 linux target descriptions
  Lazily and dynamically create i386-linux target descriptions
  Remove builtin tdesc_i386_*_linux

 gdb/features/aarch64.c                             | 184 ++++---
 gdb/features/arc-arcompact.c                       | 119 +++--
 gdb/features/arc-v2.c                              | 119 +++--
 gdb/features/arm/arm-with-iwmmxt.c                 | 126 +++--
 gdb/features/arm/arm-with-m-fpa-layout.c           |  76 ++-
 gdb/features/arm/arm-with-m-vfp-d16.c              | 106 ++--
 gdb/features/arm/arm-with-m.c                      |  57 ++-
 gdb/features/arm/arm-with-neon.c                   | 153 ++++--
 gdb/features/arm/arm-with-vfpv2.c                  | 106 ++--
 gdb/features/arm/arm-with-vfpv3.c                  | 138 +++--
 gdb/features/i386/amd64-avx-avx512-linux.c         | 403 +++++++++------
 gdb/features/i386/amd64-avx-avx512.c               | 366 +++++++------
 gdb/features/i386/amd64-avx-linux.c                | 244 ++++++---
 gdb/features/i386/amd64-avx-mpx-avx512-pku-linux.c | 445 ++++++++++------
 gdb/features/i386/amd64-avx-mpx-avx512-pku.c       | 408 +++++++++------
 gdb/features/i386/amd64-avx-mpx-linux.c            | 271 ++++++----
 gdb/features/i386/amd64-avx-mpx.c                  | 234 +++++----
 gdb/features/i386/amd64-avx.c                      | 207 +++++---
 gdb/features/i386/amd64-linux.c                    | 199 ++++---
 gdb/features/i386/amd64-mpx-linux.c                | 226 +++++---
 gdb/features/i386/amd64-mpx.c                      | 189 ++++---
 gdb/features/i386/amd64.c                          | 162 +++---
 gdb/features/i386/i386-avx-avx512-linux.c          | 213 +++++---
 gdb/features/i386/i386-avx-avx512.c                | 205 +++++---
 gdb/features/i386/i386-avx-linux.c                 | 168 +++---
 gdb/features/i386/i386-avx-mpx-avx512-pku-linux.c  | 251 ++++++---
 gdb/features/i386/i386-avx-mpx-avx512-pku.c        | 247 ++++++---
 gdb/features/i386/i386-avx-mpx-linux.c             | 192 ++++---
 gdb/features/i386/i386-avx-mpx.c                   | 186 ++++---
 gdb/features/i386/i386-avx.c                       | 159 ++++--
 gdb/features/i386/i386-linux.c                     | 142 +++--
 gdb/features/i386/i386-linux.xml                   |   2 +-
 gdb/features/i386/i386-mmx-linux.c                 | 105 ++--
 gdb/features/i386/i386-mmx.c                       |  96 ++--
 gdb/features/i386/i386-mpx-linux.c                 | 164 +++---
 gdb/features/i386/i386-mpx.c                       | 157 ++++--
 gdb/features/i386/i386.c                           | 130 +++--
 gdb/features/i386/x32-avx-avx512-linux.c           | 403 +++++++++------
 gdb/features/i386/x32-avx-avx512.c                 | 366 +++++++------
 gdb/features/i386/x32-avx-linux.c                  | 244 ++++++---
 gdb/features/i386/x32-avx.c                        | 207 +++++---
 gdb/features/i386/x32-linux.c                      | 199 ++++---
 gdb/features/i386/x32.c                            | 162 +++---
 gdb/features/microblaze-with-stack-protect.c       | 155 +++---
 gdb/features/microblaze.c                          | 136 ++---
 gdb/features/mips-dsp-linux.c                      | 258 ++++++----
 gdb/features/mips-linux.c                          | 224 +++++---
 gdb/features/mips64-dsp-linux.c                    | 256 +++++----
 gdb/features/mips64-linux.c                        | 222 +++++---
 gdb/features/nds32.c                               | 190 ++++---
 gdb/features/nios2-linux.c                         | 120 +++--
 gdb/features/nios2.c                               | 120 +++--
 gdb/features/rs6000/powerpc-32.c                   | 182 ++++---
 gdb/features/rs6000/powerpc-32l.c                  | 204 +++++---
 gdb/features/rs6000/powerpc-403.c                  | 355 +++++++------
 gdb/features/rs6000/powerpc-403gc.c                | 367 +++++++------
 gdb/features/rs6000/powerpc-405.c                  | 290 ++++++-----
 gdb/features/rs6000/powerpc-505.c                  | 313 ++++++-----
 gdb/features/rs6000/powerpc-601.c                  | 324 +++++++-----
 gdb/features/rs6000/powerpc-602.c                  | 328 +++++++-----
 gdb/features/rs6000/powerpc-603.c                  | 328 +++++++-----
 gdb/features/rs6000/powerpc-604.c                  | 327 +++++++-----
 gdb/features/rs6000/powerpc-64.c                   | 182 ++++---
 gdb/features/rs6000/powerpc-64l.c                  | 204 +++++---
 gdb/features/rs6000/powerpc-7400.c                 | 379 ++++++++------
 gdb/features/rs6000/powerpc-750.c                  | 354 +++++++------
 gdb/features/rs6000/powerpc-860.c                  | 401 +++++++++------
 gdb/features/rs6000/powerpc-altivec32.c            | 273 ++++++----
 gdb/features/rs6000/powerpc-altivec32l.c           | 291 ++++++-----
 gdb/features/rs6000/powerpc-altivec64.c            | 273 ++++++----
 gdb/features/rs6000/powerpc-altivec64l.c           | 291 ++++++-----
 gdb/features/rs6000/powerpc-cell32l.c              | 293 ++++++-----
 gdb/features/rs6000/powerpc-cell64l.c              | 293 ++++++-----
 gdb/features/rs6000/powerpc-e500.c                 | 184 ++++---
 gdb/features/rs6000/powerpc-e500l.c                | 206 +++++---
 gdb/features/rs6000/powerpc-isa205-32l.c           | 204 +++++---
 gdb/features/rs6000/powerpc-isa205-64l.c           | 204 +++++---
 gdb/features/rs6000/powerpc-isa205-altivec32l.c    | 291 ++++++-----
 gdb/features/rs6000/powerpc-isa205-altivec64l.c    | 291 ++++++-----
 gdb/features/rs6000/powerpc-isa205-vsx32l.c        | 368 +++++++------
 gdb/features/rs6000/powerpc-isa205-vsx64l.c        | 368 +++++++------
 gdb/features/rs6000/powerpc-vsx32.c                | 350 +++++++------
 gdb/features/rs6000/powerpc-vsx32l.c               | 368 +++++++------
 gdb/features/rs6000/powerpc-vsx64.c                | 350 +++++++------
 gdb/features/rs6000/powerpc-vsx64l.c               | 368 +++++++------
 gdb/features/rs6000/rs6000.c                       | 184 ++++---
 gdb/features/s390-linux32.c                        | 173 ++++---
 gdb/features/s390-linux32v1.c                      | 175 ++++---
 gdb/features/s390-linux32v2.c                      | 177 ++++---
 gdb/features/s390-linux64.c                        | 205 +++++---
 gdb/features/s390-linux64v1.c                      | 207 +++++---
 gdb/features/s390-linux64v2.c                      | 209 +++++---
 gdb/features/s390-te-linux64.c                     | 262 ++++++----
 gdb/features/s390-tevx-linux64.c                   | 343 ++++++++-----
 gdb/features/s390-vx-linux64.c                     | 290 +++++++----
 gdb/features/s390x-linux64.c                       | 173 ++++---
 gdb/features/s390x-linux64v1.c                     | 175 ++++---
 gdb/features/s390x-linux64v2.c                     | 177 ++++---
 gdb/features/s390x-te-linux64.c                    | 230 ++++++---
 gdb/features/s390x-tevx-linux64.c                  | 311 ++++++-----
 gdb/features/s390x-vx-linux64.c                    | 258 ++++++----
 gdb/features/tic6x-c62x-linux.c                    |  90 ++--
 gdb/features/tic6x-c62x.c                          |  90 ++--
 gdb/features/tic6x-c64x-linux.c                    | 169 +++---
 gdb/features/tic6x-c64x.c                          | 169 +++---
 gdb/features/tic6x-c64xp-linux.c                   | 192 ++++---
 gdb/features/tic6x-c64xp.c                         | 192 ++++---
 gdb/i386-linux-tdep.c                              | 103 +++-
 gdb/i386-linux-tdep.h                              |  10 +-
 gdb/mips-linux-nat.c                               |  11 -
 gdb/mips-linux-tdep.c                              |  11 +
 gdb/mips-linux-tdep.h                              |   6 +
 gdb/target-descriptions.c                          | 570 ++++++++++++++++++---
 gdb/target-descriptions.h                          |  20 +
 gdb/testsuite/gdb.xml/maint_print_struct.exp       |   4 +-
 gdb/x86-linux-nat.c                                |  24 +-
 gdb/xml-tdesc.c                                    |   7 +-
 117 files changed, 15741 insertions(+), 9497 deletions(-)

-- 
1.9.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]