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]

[PATCH 0/7] Pass ptid to target_ops register methods


GDB uses global variables a lot to indirectly pass information about the debug
context between functions.  This patch series tries to reduce this practice a
tiny bit by adding a ptid parameter to the register access methods of the
target_ops interface.  This removes a lot of direct references to inferior_ptid
in low level code.  Instead, the callers of to_fetch_registers /
to_store_registers / to_prepare_to_store provide the ptid on which to operate.

One of the goals is to reduce the number of times we need to save and restore
inferior_ptid.  It should also make it easier to track down the context of why
we are reading/writing registers of a certain thread by looking at the stack.

The buildbot shows good results x86 (32 and 64) and PowerPC.  s390 has some
regressions, but I think it's unrelated:

  new FAIL: gdb.python/py-mi-events.exp: verify python support
  new FAIL: gdb.python/py-mi-events.exp: check if python 2.4
  PASS -> FAIL: gdb.threads/schedlock.exp: schedlock=off: cmd=next: call_function=0: other threads ran - unlocked

I built-tested a few other platforms:

 - mips64el/linux
 - m68k/linux
 - powerpc/linux
 - powerpc/aix
 - arm/linux
 - aarch64/linux
 - s390x/linux
 - x86-64/windows (a x86_64-w64-mingw32 toolchain)

Here are the platforms I didn't test at all:

 - anything BSD
 - OS X

I tried to identify all the locations impacted by this change and update them
accordingly, but it's almost certain that I forgot or messed up some, sorry in
advance.

Simon Marchi (7):
  windows: Don't use current_thread for register fetch/store
  Add overload of s390_inferior_tid with a parameter
  Define and use typedefs for bsd_uthread_ops fields
  Pass down ptid in bsd_uthread_ops layer
  Pass ptid to target_fetch_registers
  Pass ptid to target_store_registers
  Pass ptid to to_prepare_to_store

 gdb/aarch64-linux-nat.c      | 36 +++++++++++------------
 gdb/aix-thread.c             | 22 +++++++-------
 gdb/alpha-bsd-nat.c          | 18 +++++++-----
 gdb/amd64-bsd-nat.c          | 24 ++++++++-------
 gdb/amd64-fbsd-tdep.c        | 13 ++++++--
 gdb/amd64-linux-nat.c        | 14 +++++----
 gdb/amd64-obsd-tdep.c        | 13 ++++++--
 gdb/arm-linux-nat.c          | 70 +++++++++++++++++++++++---------------------
 gdb/arm-nbsd-nat.c           | 56 ++++++++++++++++++-----------------
 gdb/bsd-kvm.c                |  3 +-
 gdb/bsd-uthread.c            | 39 ++++++++++++------------
 gdb/bsd-uthread.h            | 19 +++++++-----
 gdb/corelow.c                |  6 ++--
 gdb/ctf.c                    |  3 +-
 gdb/fbsd-tdep.c              |  6 +---
 gdb/go32-nat.c               |  6 ++--
 gdb/hppa-linux-nat.c         | 26 ++++++++--------
 gdb/hppa-nbsd-nat.c          | 18 +++++++-----
 gdb/hppa-obsd-nat.c          | 18 +++++++-----
 gdb/i386-bsd-nat.c           | 30 ++++++++++---------
 gdb/i386-darwin-nat.c        | 10 ++++---
 gdb/i386-fbsd-tdep.c         | 13 ++++++--
 gdb/i386-gnu-nat.c           | 14 +++++----
 gdb/i386-linux-nat.c         | 32 ++++++++++----------
 gdb/i386-obsd-tdep.c         | 13 ++++++--
 gdb/ia64-linux-nat.c         | 27 +++++++++--------
 gdb/inf-child.c              |  9 ++++--
 gdb/inf-ptrace.c             | 28 ++++++++++--------
 gdb/linux-tdep.c             |  4 ++-
 gdb/m32r-linux-nat.c         | 14 +++++----
 gdb/m68k-bsd-nat.c           | 18 +++++++-----
 gdb/m68k-linux-nat.c         | 45 +++++++++++++++-------------
 gdb/m88k-bsd-nat.c           | 12 ++++----
 gdb/mips-fbsd-nat.c          | 18 +++++++-----
 gdb/mips-linux-nat.c         | 45 +++++++++++++++-------------
 gdb/mips-nbsd-nat.c          | 18 +++++++-----
 gdb/mips64-obsd-nat.c        | 12 ++++----
 gdb/nto-procfs.c             | 12 ++++----
 gdb/ppc-fbsd-nat.c           | 18 +++++++-----
 gdb/ppc-linux-nat.c          | 14 +++++----
 gdb/ppc-nbsd-nat.c           | 18 +++++++-----
 gdb/ppc-obsd-nat.c           | 18 +++++++-----
 gdb/ppc-ravenscar-thread.c   | 32 ++++++++++++--------
 gdb/proc-service.c           | 36 ++++++++---------------
 gdb/procfs.c                 | 22 +++++++-------
 gdb/ravenscar-thread.c       | 41 +++++++++++++-------------
 gdb/ravenscar-thread.h       |  6 ++--
 gdb/record-btrace.c          | 21 +++++++------
 gdb/record-full.c            | 13 ++++----
 gdb/regcache.c               |  6 ++--
 gdb/remote-sim.c             | 22 +++++++++-----
 gdb/remote.c                 | 17 ++++++-----
 gdb/rs6000-aix-tdep.c        |  3 +-
 gdb/rs6000-lynx178-tdep.c    |  3 +-
 gdb/rs6000-nat.c             | 66 +++++++++++++++++++++--------------------
 gdb/s390-linux-nat.c         | 26 +++++++++++-----
 gdb/sh-nbsd-nat.c            | 12 ++++----
 gdb/sol-thread.c             | 22 +++++++-------
 gdb/sparc-nat.c              | 14 +++++----
 gdb/sparc-nat.h              |  4 +--
 gdb/sparc-obsd-tdep.c        | 13 ++++++--
 gdb/sparc-ravenscar-thread.c | 20 ++++++-------
 gdb/sparc64-obsd-tdep.c      | 13 ++++++--
 gdb/spu-linux-nat.c          |  3 +-
 gdb/spu-multiarch.c          | 14 ++++-----
 gdb/target-delegates.c       | 40 ++++++++++++++-----------
 gdb/target.c                 |  8 ++---
 gdb/target.h                 | 21 ++++++++-----
 gdb/tilegx-linux-nat.c       | 14 +++++----
 gdb/tracefile-tfile.c        |  4 +--
 gdb/vax-bsd-nat.c            | 12 ++++----
 gdb/windows-nat.c            | 49 +++++++++++++++----------------
 gdb/xtensa-linux-nat.c       | 46 +++++++++++++++--------------
 73 files changed, 819 insertions(+), 656 deletions(-)

-- 
2.11.0


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