public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Gustavo Romero <gustavo.romero@linaro.org>
To: gdb-patches@sourceware.org
Cc: luis.machado@arm.com, thiago.bauermann@linaro.org, eliz@gnu.org,
	tom@tromey.com, gustavo.romero@linaro.org
Subject: [PATCH v5 4/8] gdb: Use passed gdbarch instead of calling current_inferior
Date: Wed, 17 Apr 2024 21:04:20 +0000	[thread overview]
Message-ID: <20240417210424.216374-5-gustavo.romero@linaro.org> (raw)
In-Reply-To: <20240417210424.216374-1-gustavo.romero@linaro.org>

In do_examine function, use passed gdbarch when checking if an address
is tagged instead of calling current_inferior()->arch() to make the code
more localized and help modularity by not calling a current_* function,
which disguises the use of a global state/variable. There is no change
in the code behavior.

Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
Suggested-by: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
Approved-By: Luis Machado <luis.machado@arm.com>
Tested-By: Luis Machado <luis.machado@arm.com>
---
 gdb/printcmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 5635f605314..4edbd458e4d 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1132,7 +1132,7 @@ do_examine (struct format_data fmt, struct gdbarch *gdbarch, CORE_ADDR addr)
 	    = value_from_ulongest (builtin_type (gdbarch)->builtin_data_ptr,
 				   tag_laddr);
 
-	  if (gdbarch_tagged_address_p (current_inferior ()->arch  (), v_addr))
+	  if (gdbarch_tagged_address_p (gdbarch, v_addr))
 	    {
 	      /* Fetch the allocation tag.  */
 	      struct value *tag
-- 
2.34.1


  parent reply	other threads:[~2024-04-17 21:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-17 21:04 [PATCH v5 0/8] Add another way to check tagged addresses on remote targets Gustavo Romero
2024-04-17 21:04 ` [PATCH v5 1/8] gdb: aarch64: Remove MTE address checking from get_memtag Gustavo Romero
2024-04-17 21:04 ` [PATCH v5 2/8] gdb: aarch64: Move MTE address check out of set_memtag Gustavo Romero
2024-04-17 21:04 ` [PATCH v5 3/8] gdb: aarch64: Remove MTE address checking from memtag_matches_p Gustavo Romero
2024-04-17 21:04 ` Gustavo Romero [this message]
2024-04-17 21:04 ` [PATCH v5 5/8] gdb: Introduce is_address_tagged target hook Gustavo Romero
2024-04-17 21:04 ` [PATCH v5 6/8] gdb: Add qIsAddressTagged packet Gustavo Romero
2024-04-18 10:37   ` Luis Machado
2024-04-17 21:04 ` [PATCH v5 7/8] gdb/testsuite: Add unit tests for " Gustavo Romero
2024-04-18 10:39   ` Luis Machado
2024-04-17 21:04 ` [PATCH v5 8/8] gdb: Document " Gustavo Romero
2024-04-18  5:18   ` Eli Zaretskii

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=20240417210424.216374-5-gustavo.romero@linaro.org \
    --to=gustavo.romero@linaro.org \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=luis.machado@arm.com \
    --cc=thiago.bauermann@linaro.org \
    --cc=tom@tromey.com \
    /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).