From: Gustavo Romero Date: Thu, 18 Apr 2024 20:10:35 +0000 (+0000) Subject: gdb: Use passed gdbarch instead of calling current_inferior X-Git-Tag: gdb-15-branchpoint~342 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a0e28bb1515572fca428b452a523f882eea16797;p=thirdparty%2Fbinutils-gdb.git gdb: Use passed gdbarch instead of calling current_inferior 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 Suggested-by: Thiago Jung Bauermann Approved-By: Luis Machado Tested-By: Luis Machado --- 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