aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog16
-rw-r--r--gdb/aarch64-linux-nat.c2
-rw-r--r--gdb/arm-linux-nat.c4
-rw-r--r--gdb/ppc-linux-nat.c4
-rw-r--r--gdb/riscv-linux-nat.c2
-rw-r--r--gdb/s390-linux-nat.c2
-rw-r--r--gdb/target.h15
-rw-r--r--gdb/x86-linux-nat.c5
8 files changed, 34 insertions, 16 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 6e09089..480d204 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,19 @@
+2021-05-23 Tom de Vries <tdevries@suse.de>
+
+ PR tdep/27822
+ * target.h (struct target_ops): Mention target_thread_architecture in
+ read_description comment.
+ * x86-linux-nat.c (x86_linux_nat_target::read_description): Use
+ pid to determine if process is 64-bit or 32-bit.
+ * aarch64-linux-nat.c (aarch64_linux_nat_target::read_description):
+ Same.
+ * ppc-linux-nat.c (ppc_linux_nat_target::read_description): Same.
+ * riscv-linux-nat.c (riscv_linux_nat_target::read_description): Same.
+ * s390-linux-nat.c (s390_linux_nat_target::read_description): Same.
+ * arm-linux-nat.c (arm_linux_nat_target::read_description): Same.
+ Likewise, use pid to determine if kernel supports reading VFP
+ registers.
+
2021-05-22 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* main.c (enum cmdarg_kind): Fix option type comments for
diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c
index ae8db29..6122402 100644
--- a/gdb/aarch64-linux-nat.c
+++ b/gdb/aarch64-linux-nat.c
@@ -723,7 +723,7 @@ aarch64_linux_nat_target::read_description ()
gdb_byte regbuf[ARM_VFP3_REGS_SIZE];
struct iovec iovec;
- tid = inferior_ptid.lwp ();
+ tid = inferior_ptid.pid ();
iovec.iov_base = regbuf;
iovec.iov_len = ARM_VFP3_REGS_SIZE;
diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c
index 662dade..880ac0d 100644
--- a/gdb/arm-linux-nat.c
+++ b/gdb/arm-linux-nat.c
@@ -537,7 +537,7 @@ arm_linux_nat_target::read_description ()
{
elf_gregset_t gpregs;
struct iovec iov;
- int tid = inferior_ptid.lwp ();
+ int tid = inferior_ptid.pid ();
iov.iov_base = &gpregs;
iov.iov_len = sizeof (gpregs);
@@ -556,7 +556,7 @@ arm_linux_nat_target::read_description ()
{
/* Make sure that the kernel supports reading VFP registers. Support was
added in 2.6.30. */
- int pid = inferior_ptid.lwp ();
+ int pid = inferior_ptid.pid ();
errno = 0;
char *buf = (char *) alloca (ARM_VFP3_REGS_SIZE);
if (ptrace (PTRACE_GETVFPREGS, pid, 0, buf) < 0 && errno == EIO)
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
index 171f5b3..06a30ef 100644
--- a/gdb/ppc-linux-nat.c
+++ b/gdb/ppc-linux-nat.c
@@ -1946,9 +1946,7 @@ ppc_linux_nat_target::auxv_parse (gdb_byte **readptr,
const struct target_desc *
ppc_linux_nat_target::read_description ()
{
- int tid = inferior_ptid.lwp ();
- if (tid == 0)
- tid = inferior_ptid.pid ();
+ int tid = inferior_ptid.pid ();
if (have_ptrace_getsetevrregs)
{
diff --git a/gdb/riscv-linux-nat.c b/gdb/riscv-linux-nat.c
index 04bf46b..c0f5a27 100644
--- a/gdb/riscv-linux-nat.c
+++ b/gdb/riscv-linux-nat.c
@@ -202,7 +202,7 @@ const struct target_desc *
riscv_linux_nat_target::read_description ()
{
const struct riscv_gdbarch_features features
- = riscv_linux_read_features (inferior_ptid.lwp ());
+ = riscv_linux_read_features (inferior_ptid.pid ());
return riscv_lookup_target_description (features);
}
diff --git a/gdb/s390-linux-nat.c b/gdb/s390-linux-nat.c
index 41b50ce..8f6eb61 100644
--- a/gdb/s390-linux-nat.c
+++ b/gdb/s390-linux-nat.c
@@ -988,7 +988,7 @@ s390_linux_nat_target::auxv_parse (gdb_byte **readptr,
const struct target_desc *
s390_linux_nat_target::read_description ()
{
- int tid = s390_inferior_tid ();
+ int tid = inferior_ptid.pid ();
have_regset_last_break
= check_regset (tid, NT_S390_LAST_BREAK, 8);
diff --git a/gdb/target.h b/gdb/target.h
index d867a58..e22f903 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -838,10 +838,17 @@ struct target_ops
virtual void flash_done ()
TARGET_DEFAULT_NORETURN (tcomplain ());
- /* Describe the architecture-specific features of this target. If
- OPS doesn't have a description, this should delegate to the
- "beneath" target. Returns the description found, or NULL if no
- description was available. */
+ /* Describe the architecture-specific features of the current
+ inferior.
+
+ Returns the description found, or nullptr if no description was
+ available.
+
+ If some target features differ between threads, the description
+ returned by read_description (and the resulting gdbarch) won't
+ accurately describe all threads. In this case, the
+ thread_architecture method can be used to obtain gdbarches that
+ accurately describe each thread. */
virtual const struct target_desc *read_description ()
TARGET_DEFAULT_RETURN (NULL);
diff --git a/gdb/x86-linux-nat.c b/gdb/x86-linux-nat.c
index 85c7f0d..adea1ad 100644
--- a/gdb/x86-linux-nat.c
+++ b/gdb/x86-linux-nat.c
@@ -113,10 +113,7 @@ x86_linux_nat_target::read_description ()
static uint64_t xcr0;
uint64_t xcr0_features_bits;
- /* GNU/Linux LWP ID's are process ID's. */
- tid = inferior_ptid.lwp ();
- if (tid == 0)
- tid = inferior_ptid.pid (); /* Not a threaded program. */
+ tid = inferior_ptid.pid ();
#ifdef __x86_64__
{