Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Alan Hayward via Gdb-patches <gdb-patches@sourceware.org>
To: Tom de Vries <tdevries@suse.de>
Cc: Andreas Arnez <arnez@linux.ibm.com>, nd <nd@arm.com>,
	"gdb-patches\\@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [PATCH][gdb/tdep] Use pid to choose x86_64 process 64/32-bitness
Date: Thu, 20 May 2021 10:42:21 +0000	[thread overview]
Message-ID: <977346CD-5DE9-49E0-A4C2-061792548857@arm.com> (raw)
In-Reply-To: <e1f3b82e-db5a-56bc-01f8-58724105a954@suse.de>


On 19 May 2021, at 17:32, Tom de Vries <tdevries@suse.de<mailto:tdevries@suse.de>> wrote:




---
gdb/aarch64-linux-nat.c | 2 +-
gdb/arm-linux-nat.c     | 2 +-
gdb/ppc-linux-nat.c     | 4 +---
gdb/s390-linux-nat.c    | 2 +-
gdb/x86-linux-nat.c     | 5 +----
5 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c
index ae8db2988c2..61224022f6a 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 ();

A user level process is either AArch64 or AArch32, it can only change by execve().
All threads in a single process will be the same architecture.

As was mentioned above somewhere, SVE can have different vector lengths per thread.

Therefore, this needs to stay as lwp.

Maybe this needs a comment, something like:
// Use lwp as sve vector length can change per thread.


  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 662dade0a12..b5b470b6876 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 ();


Arm port is only ever going to be 32bits, so this change is probably not that useful.
Fine with the change for consistency reasons across the ports.

If making this change, could you also change the other inferior_ptid.lwp call in the
same function (line 559).



      iov.iov_base = &gpregs;
      iov.iov_len = sizeof (gpregs);
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
index 171f5b386fa..06a30efeaef 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/s390-linux-nat.c b/gdb/s390-linux-nat.c
index 41b50ce4800..8f6eb61505b 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/x86-linux-nat.c b/gdb/x86-linux-nat.c
index 85c7f0ddc94..adea1ad0092 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__
  {


Thanks,
Alan.


  reply	other threads:[~2021-05-20 10:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-07  8:44 Tom de Vries
2021-05-07 19:27 ` Simon Marchi via Gdb-patches
2021-05-07 20:06   ` Luis Machado via Gdb-patches
2021-05-19 16:32   ` Tom de Vries
2021-05-20 10:42     ` Alan Hayward via Gdb-patches [this message]
2021-05-20 16:07       ` Simon Marchi via Gdb-patches
2021-05-21 10:50         ` Alan Hayward via Gdb-patches
2021-05-22  8:32           ` Tom de Vries
2021-05-22  9:56             ` Tom de Vries
2021-05-23  1:27               ` Simon Marchi via Gdb-patches

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=977346CD-5DE9-49E0-A4C2-061792548857@arm.com \
    --to=gdb-patches@sourceware.org \
    --cc=Alan.Hayward@arm.com \
    --cc=arnez@linux.ibm.com \
    --cc=nd@arm.com \
    --cc=tdevries@suse.de \
    /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