[PATCH 00/22 v4] Make GDB builtin target descriptions more flexible

Yao Qi qiyaoltc@gmail.com
Mon Aug 21 15:29:00 GMT 2017


This patch series is to change GDB and GDBserver builtin target
descriptions more flexible, by removing pre-generated ones.  Nowadays,
GDB builtin target descriptions are created from initialize_tdesc_*
functions in features/*.c files, while GDBserver builtin target
descriptions are generated from regformats/*.dat files.  Instead,
with these patches applied, these builtin target descriptions can be
got lazily and dynamically.

This patch series changes both GDB and GDBserver to create target
description dynamically from features, instead of using pre-generated
target descriptions.  This patch series only convert x86 target
descriptions to demonstrate the usefulness of the change.

Once one target architecture switches to the new flexible target
description,

 - We only need xml feature files under gdb/features directory.  All
 existing target description xml files can be kept for tests.  Add
 new xml feature file if we want to support the new feature, but
 don't need to add new target description xml files.

 - All existing gdb/regformats/*.dat are not used, but kept for
 the tests.

This is the v4, and v3 can be found
https://sourceware.org/ml/gdb-patches/2017-07/msg00076.html
v3 changes only x86-linux target descriptions, while v4 changes the
whole x86 target descriptions.  The rest of patches aren't changed
since v3.  The first four patches are new in v4, which is about
getting target descriptions via {i386,amd64}_target_description.

I pushed my branch to users/qiyao/target-desc-4

*** BLURB HERE ***

Yao Qi (22):
  Use amd64_target_description to get tdesc_amd64
  Use i386_target_description to get tdesc_i386
  Return X86_XSTATE_SSE_MASK instead of 0 in i386fbsd_core_read_xcr0
  Let i386_target_description return tdesc_i386_mmx
  Adjust code generated by regformats/regdat.sh
  Use VEC for target_desc.reg_defs
  Return X86_TDESC_MMX in x86_get_ipa_tdesc_idx
  [GDBserver] Centralize tdesc for i386-linux
  [GDBserver] unit test to i386_tdesc
  Dynamically composite xml in reply to GDB
  Share i386-linux target description between GDB and GDBserver
  Remove features/i386/i386-*linux.c
  [GDBserver] Use pre-generated tdesc as test
  [GDBserver] Shorten srv_i386_linux_xmlfiles
  Update comments in amd64_linux_core_read_description
  Centralize amd64-linux target descriptions
  Lazily and dynamically create amd64-linux target descriptions
  Convert amd64-linux target descriptions
  [GDBserver] Use pre-generated amd64-linux tdesc as test
  [GDBserver] Shorten srv_amd64_linux_xmlfiles
  Remove features/i386/amd64-*linux.c and features/i386/x32-*linux.c
  Convert the rest x86 target descriptions

 gdb/Makefile.in                                    |   4 +
 gdb/amd64-darwin-tdep.c                            |   4 +-
 gdb/amd64-dicos-tdep.c                             |   4 +-
 gdb/amd64-fbsd-nat.c                               |   4 +-
 gdb/amd64-fbsd-tdep.c                              |   3 +-
 gdb/amd64-linux-tdep.c                             | 124 ++++----
 gdb/amd64-linux-tdep.h                             |   6 +
 gdb/amd64-nbsd-tdep.c                              |   4 +-
 gdb/amd64-obsd-tdep.c                              |   4 +-
 gdb/amd64-sol2-tdep.c                              |   4 +-
 gdb/amd64-tdep.c                                   |  66 +++--
 gdb/amd64-tdep.h                                   |   2 -
 gdb/amd64-windows-tdep.c                           |   4 +-
 gdb/arch/amd64.c                                   |  74 +++++
 gdb/arch/amd64.h                                   |  22 ++
 gdb/arch/i386.c                                    |  68 +++++
 gdb/arch/i386.h                                    |  21 ++
 gdb/arch/tdesc.h                                   |  92 ++++++
 gdb/configure.tgt                                  |  63 ++--
 gdb/features/Makefile                              |  40 +--
 gdb/features/i386/32bit-avx.c                      |   4 +-
 gdb/features/i386/32bit-avx512.c                   |   4 +-
 gdb/features/i386/32bit-core.c                     |   4 +-
 gdb/features/i386/32bit-linux.c                    |   4 +-
 gdb/features/i386/32bit-mpx.c                      |   4 +-
 gdb/features/i386/32bit-pkeys.c                    |   4 +-
 gdb/features/i386/32bit-sse.c                      |   4 +-
 gdb/features/i386/64bit-avx.c                      |  29 ++
 gdb/features/i386/64bit-avx512.c                   | 124 ++++++++
 gdb/features/i386/64bit-core.c                     |  74 +++++
 gdb/features/i386/64bit-linux.c                    |  15 +
 gdb/features/i386/64bit-mpx.c                      |  51 ++++
 gdb/features/i386/64bit-pkeys.c                    |  14 +
 gdb/features/i386/64bit-segments.c                 |  15 +
 gdb/features/i386/64bit-sse.c                      |  83 ++++++
 gdb/features/i386/amd64-avx-avx512-linux.c         | 288 ------------------
 gdb/features/i386/amd64-avx-avx512.c               | 283 ------------------
 gdb/features/i386/amd64-avx-linux.c                | 177 -----------
 gdb/features/i386/amd64-avx-mpx-avx512-pku-linux.c | 329 ---------------------
 gdb/features/i386/amd64-avx-mpx-avx512-pku.c       | 324 --------------------
 gdb/features/i386/amd64-avx-mpx-linux.c            | 215 --------------
 gdb/features/i386/amd64-avx-mpx.c                  | 210 -------------
 gdb/features/i386/amd64-avx.c                      | 172 -----------
 gdb/features/i386/amd64-linux.c                    | 159 ----------
 gdb/features/i386/amd64-mpx-linux.c                | 197 ------------
 gdb/features/i386/amd64-mpx.c                      | 192 ------------
 gdb/features/i386/amd64.c                          | 154 ----------
 gdb/features/i386/i386-avx-avx512-linux.c          | 170 -----------
 gdb/features/i386/i386-avx-avx512.c                | 165 -----------
 gdb/features/i386/i386-avx-linux.c                 | 149 ----------
 gdb/features/i386/i386-avx-mpx-avx512-pku-linux.c  | 211 -------------
 gdb/features/i386/i386-avx-mpx-avx512-pku.c        | 206 -------------
 gdb/features/i386/i386-avx-mpx-linux.c             | 187 ------------
 gdb/features/i386/i386-avx-mpx.c                   | 182 ------------
 gdb/features/i386/i386-avx.c                       | 144 ---------
 gdb/features/i386/i386-linux.c                     | 139 ---------
 gdb/features/i386/i386-mmx-linux.c                 |  78 -----
 gdb/features/i386/i386-mmx.c                       |  73 -----
 gdb/features/i386/i386-mpx-linux.c                 | 177 -----------
 gdb/features/i386/i386-mpx.c                       | 172 -----------
 gdb/features/i386/i386.c                           | 134 ---------
 gdb/features/i386/x32-avx-avx512-linux.c           | 288 ------------------
 gdb/features/i386/x32-avx-linux.c                  | 177 -----------
 gdb/features/i386/x32-core.c                       |  74 +++++
 gdb/features/i386/x32-linux.c                      | 159 ----------
 gdb/gdbserver/Makefile.in                          |  13 +
 gdb/gdbserver/configure.srv                        |  55 ++--
 gdb/gdbserver/linux-amd64-ipa.c                    |  56 ++--
 gdb/gdbserver/linux-i386-ipa.c                     |  39 +--
 gdb/gdbserver/linux-x86-low.c                      | 146 ++-------
 gdb/gdbserver/linux-x86-tdesc-selftest.c           | 183 ++++++++++++
 gdb/gdbserver/linux-x86-tdesc.c                    | 173 +++++++++++
 gdb/gdbserver/linux-x86-tdesc.h                    |  78 +----
 gdb/gdbserver/lynx-i386-low.c                      |   9 +-
 gdb/gdbserver/nto-x86-low.c                        |  11 +-
 gdb/gdbserver/regcache.c                           |  34 ++-
 gdb/gdbserver/server.c                             |  10 +-
 gdb/gdbserver/tdesc.c                              | 186 +++++++++++-
 gdb/gdbserver/tdesc.h                              | 106 ++++++-
 gdb/gdbserver/win32-i386-low.c                     |  22 +-
 gdb/i386-fbsd-nat.c                                |  10 +-
 gdb/i386-fbsd-tdep.c                               |   4 +-
 gdb/i386-go32-tdep.c                               |   3 +-
 gdb/i386-linux-tdep.c                              |  37 +--
 gdb/i386-tdep.c                                    |  73 +++--
 gdb/i386-tdep.h                                    |   3 -
 gdb/regformats/regdat.sh                           |  26 +-
 gdb/regformats/regdef.h                            |  12 +
 gdb/target-descriptions.c                          |  62 ++--
 gdb/target-descriptions.h                          |  37 +--
 gdb/x86-linux-nat.c                                |  35 +--
 91 files changed, 1858 insertions(+), 6196 deletions(-)
 create mode 100644 gdb/arch/amd64.c
 create mode 100644 gdb/arch/amd64.h
 create mode 100644 gdb/arch/i386.c
 create mode 100644 gdb/arch/i386.h
 create mode 100644 gdb/arch/tdesc.h
 create mode 100644 gdb/features/i386/64bit-avx.c
 create mode 100644 gdb/features/i386/64bit-avx512.c
 create mode 100644 gdb/features/i386/64bit-core.c
 create mode 100644 gdb/features/i386/64bit-linux.c
 create mode 100644 gdb/features/i386/64bit-mpx.c
 create mode 100644 gdb/features/i386/64bit-pkeys.c
 create mode 100644 gdb/features/i386/64bit-segments.c
 create mode 100644 gdb/features/i386/64bit-sse.c
 delete mode 100644 gdb/features/i386/amd64-avx-avx512-linux.c
 delete mode 100644 gdb/features/i386/amd64-avx-avx512.c
 delete mode 100644 gdb/features/i386/amd64-avx-linux.c
 delete mode 100644 gdb/features/i386/amd64-avx-mpx-avx512-pku-linux.c
 delete mode 100644 gdb/features/i386/amd64-avx-mpx-avx512-pku.c
 delete mode 100644 gdb/features/i386/amd64-avx-mpx-linux.c
 delete mode 100644 gdb/features/i386/amd64-avx-mpx.c
 delete mode 100644 gdb/features/i386/amd64-avx.c
 delete mode 100644 gdb/features/i386/amd64-linux.c
 delete mode 100644 gdb/features/i386/amd64-mpx-linux.c
 delete mode 100644 gdb/features/i386/amd64-mpx.c
 delete mode 100644 gdb/features/i386/amd64.c
 delete mode 100644 gdb/features/i386/i386-avx-avx512-linux.c
 delete mode 100644 gdb/features/i386/i386-avx-avx512.c
 delete mode 100644 gdb/features/i386/i386-avx-linux.c
 delete mode 100644 gdb/features/i386/i386-avx-mpx-avx512-pku-linux.c
 delete mode 100644 gdb/features/i386/i386-avx-mpx-avx512-pku.c
 delete mode 100644 gdb/features/i386/i386-avx-mpx-linux.c
 delete mode 100644 gdb/features/i386/i386-avx-mpx.c
 delete mode 100644 gdb/features/i386/i386-avx.c
 delete mode 100644 gdb/features/i386/i386-linux.c
 delete mode 100644 gdb/features/i386/i386-mmx-linux.c
 delete mode 100644 gdb/features/i386/i386-mmx.c
 delete mode 100644 gdb/features/i386/i386-mpx-linux.c
 delete mode 100644 gdb/features/i386/i386-mpx.c
 delete mode 100644 gdb/features/i386/i386.c
 delete mode 100644 gdb/features/i386/x32-avx-avx512-linux.c
 delete mode 100644 gdb/features/i386/x32-avx-linux.c
 create mode 100644 gdb/features/i386/x32-core.c
 delete mode 100644 gdb/features/i386/x32-linux.c
 create mode 100644 gdb/gdbserver/linux-x86-tdesc-selftest.c
 create mode 100644 gdb/gdbserver/linux-x86-tdesc.c

-- 
1.9.1



More information about the Gdb-patches mailing list