From: Simon Marchi <simon.marchi@polymtl.ca>
To: John Baldwin <jhb@FreeBSD.org>, Pedro Alves <pedro@palves.net>,
gdb-patches@sourceware.org
Subject: Re: [PATCH] gdb: fix auxv caching
Date: Tue, 11 Oct 2022 21:11:18 -0400 [thread overview]
Message-ID: <69632804-660c-ff4b-cb60-367b1b69080d@polymtl.ca> (raw)
In-Reply-To: <4fca0778-8533-6f49-f86f-8bcf53b6d45b@FreeBSD.org>
On 2022-10-11 16:42, John Baldwin wrote:
>
> I think "_raw" would be better here as using the cached values should be the
> default.
Indeed, and the fact that target_read_auxv does caching is an
implementation detail.
Here's what I pushed:
From 1639fab33b5932e1a5e88e29273996f70047da85 Mon Sep 17 00:00:00 2001
From: Simon Marchi <simon.marchi@polymtl.ca>
Date: Tue, 11 Oct 2022 20:53:39 -0400
Subject: [PATCH] gdb: rename target_read_auxv(target_ops *) to
target_read_auxv_raw
Having two overloads of target_read_auxv that don't have the same goals
is confusing. Rename the one that reads from an explicit target_ops to
target_read_auxv_raw. Also, it occured to me that the non-raw version
could use the raw version, that reduces duplication a bit.
Change-Id: I28e5f7cecbfcacd0174d4686efb3e4a23b4ad491
---
gdb/aarch64-linux-tdep.c | 2 +-
gdb/arm-fbsd-tdep.c | 2 +-
gdb/arm-linux-tdep.c | 2 +-
gdb/auxv.c | 5 ++---
gdb/auxv.h | 2 +-
gdb/ppc-linux-tdep.c | 2 +-
gdb/s390-linux-tdep.c | 2 +-
7 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c
index 476db5aa3b88..a321aee036a0 100644
--- a/gdb/aarch64-linux-tdep.c
+++ b/gdb/aarch64-linux-tdep.c
@@ -780,7 +780,7 @@ aarch64_linux_core_read_description (struct gdbarch *gdbarch,
struct target_ops *target, bfd *abfd)
{
asection *tls = bfd_get_section_by_name (abfd, ".reg-aarch-tls");
- gdb::optional<gdb::byte_vector> auxv = target_read_auxv (target);
+ gdb::optional<gdb::byte_vector> auxv = target_read_auxv_raw (target);
CORE_ADDR hwcap = linux_get_hwcap (auxv, target, gdbarch);
CORE_ADDR hwcap2 = linux_get_hwcap2 (auxv, target, gdbarch);
diff --git a/gdb/arm-fbsd-tdep.c b/gdb/arm-fbsd-tdep.c
index 28fc73d694e6..4395136b83ce 100644
--- a/gdb/arm-fbsd-tdep.c
+++ b/gdb/arm-fbsd-tdep.c
@@ -238,7 +238,7 @@ arm_fbsd_core_read_description (struct gdbarch *gdbarch,
{
asection *tls = bfd_get_section_by_name (abfd, ".reg-aarch-tls");
- gdb::optional<gdb::byte_vector> auxv = target_read_auxv (target);
+ gdb::optional<gdb::byte_vector> auxv = target_read_auxv_raw (target);
return arm_fbsd_read_description_auxv (auxv, target, gdbarch, tls != nullptr);
}
diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c
index 65343f6c0758..7fa8a67ae42c 100644
--- a/gdb/arm-linux-tdep.c
+++ b/gdb/arm-linux-tdep.c
@@ -732,7 +732,7 @@ arm_linux_core_read_description (struct gdbarch *gdbarch,
struct target_ops *target,
bfd *abfd)
{
- gdb::optional<gdb::byte_vector> auxv = target_read_auxv (target);
+ gdb::optional<gdb::byte_vector> auxv = target_read_auxv_raw (target);
CORE_ADDR arm_hwcap = linux_get_hwcap (auxv, target, gdbarch);
if (arm_hwcap & HWCAP_VFP)
diff --git a/gdb/auxv.c b/gdb/auxv.c
index 5853437b0f24..51723f9b17cb 100644
--- a/gdb/auxv.c
+++ b/gdb/auxv.c
@@ -363,8 +363,7 @@ target_read_auxv ()
if (info == nullptr)
{
info = auxv_inferior_data.emplace (inf);
- info->data = target_read_alloc (inf->top_target (), TARGET_OBJECT_AUXV,
- nullptr);
+ info->data = target_read_auxv_raw (inf->top_target ());
}
return info->data;
@@ -373,7 +372,7 @@ target_read_auxv ()
/* See auxv.h. */
gdb::optional<gdb::byte_vector>
-target_read_auxv (target_ops *ops)
+target_read_auxv_raw (target_ops *ops)
{
return target_read_alloc (ops, TARGET_OBJECT_AUXV, NULL);
}
diff --git a/gdb/auxv.h b/gdb/auxv.h
index 983e3bc9b0d9..788d187b27a0 100644
--- a/gdb/auxv.h
+++ b/gdb/auxv.h
@@ -52,7 +52,7 @@ extern gdb::optional<gdb::byte_vector> target_read_auxv ();
/* Read auxv data from OPS. */
-extern gdb::optional<gdb::byte_vector> target_read_auxv (target_ops *ops);
+extern gdb::optional<gdb::byte_vector> target_read_auxv_raw (target_ops *ops);
/* Search AUXV for an entry with a_type matching MATCH.
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index 12f418fb5ac6..f7d13bac8a3e 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -1599,7 +1599,7 @@ ppc_linux_core_read_description (struct gdbarch *gdbarch,
if (vsx)
features.vsx = true;
- gdb::optional<gdb::byte_vector> auxv = target_read_auxv (target);
+ gdb::optional<gdb::byte_vector> auxv = target_read_auxv_raw (target);
CORE_ADDR hwcap = linux_get_hwcap (auxv, target, gdbarch);
features.isa205 = ppc_linux_has_isa205 (hwcap);
diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c
index ef2ed8510a64..14d71134e0cd 100644
--- a/gdb/s390-linux-tdep.c
+++ b/gdb/s390-linux-tdep.c
@@ -332,7 +332,7 @@ s390_core_read_description (struct gdbarch *gdbarch,
struct target_ops *target, bfd *abfd)
{
asection *section = bfd_get_section_by_name (abfd, ".reg");
- gdb::optional<gdb::byte_vector> auxv = target_read_auxv (target);
+ gdb::optional<gdb::byte_vector> auxv = target_read_auxv_raw (target);
CORE_ADDR hwcap = linux_get_hwcap (auxv, target, gdbarch);
bool high_gprs, v1, v2, te, vx, gs;
base-commit: 8652404e813a895dfebe8591b30e90328b6e6898
--
2.38.0
next prev parent reply other threads:[~2022-10-12 1:11 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-19 14:45 [PATCH] Update auxv cache when there is no auxv cached data Luis Machado
2022-07-25 9:42 ` [PING][PATCH] " Luis Machado
2022-07-25 16:05 ` [PATCH] " John Baldwin
2022-07-25 18:03 ` Luis Machado
2022-07-25 19:13 ` John Baldwin
2022-08-02 15:05 ` Luis Machado
2022-08-02 16:05 ` John Baldwin
2022-08-05 15:46 ` [PATCH] Update auxv cache when inferior pid is 0 (no inferior) Luis Machado
2022-08-11 9:05 ` [PING][PATCH] " Luis Machado
2022-08-18 15:48 ` Luis Machado
2022-09-01 9:29 ` Luis Machado
2022-09-07 8:20 ` Luis Machado
2022-09-12 12:48 ` Luis Machado
2022-09-12 13:30 ` [PATCH] " Simon Marchi
2022-09-12 13:53 ` John Baldwin
2022-09-12 13:59 ` Luis Machado
2022-09-20 12:28 ` [PATCH] Invalidate auxv cache before creating a core target Luis Machado
2022-09-20 17:49 ` John Baldwin
2022-10-07 20:44 ` [PATCH] gdb: fix auxv caching Simon Marchi
2022-10-07 21:43 ` John Baldwin
2022-10-09 0:39 ` Simon Marchi
2022-10-10 18:32 ` John Baldwin
2022-10-11 17:52 ` Simon Marchi
2022-10-11 20:31 ` Pedro Alves
2022-10-11 20:34 ` Pedro Alves
2022-10-11 20:42 ` John Baldwin
2022-10-12 1:11 ` Simon Marchi [this message]
2022-10-10 9:33 ` Luis Machado
2022-10-11 17:53 ` Simon Marchi
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=69632804-660c-ff4b-cb60-367b1b69080d@polymtl.ca \
--to=simon.marchi@polymtl.ca \
--cc=gdb-patches@sourceware.org \
--cc=jhb@FreeBSD.org \
--cc=pedro@palves.net \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).