From: Simon Marchi Date: Tue, 2 Dec 2025 21:09:26 +0000 (-0500) Subject: gdb: remove find_target_at X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=390dbc4a8768c379f535ac4fd2f04ba93ceb5046;p=thirdparty%2Fbinutils-gdb.git gdb: remove find_target_at ... to make the current_inferior reference bubble up one level. Since find_target_at would become a trivial wrapper around inferior::target_at, remove it. I think it's clearer anyway to see explicitly that the "subject" of the method call is the inferior. Change-Id: I73ec44d37e7afea6e85b1689af65e32ae8e5a695 Approved-By: Tom Tromey --- diff --git a/gdb/record.c b/gdb/record.c index 7f3cf541bf1..38bbfbeffff 100644 --- a/gdb/record.c +++ b/gdb/record.c @@ -62,7 +62,7 @@ struct cmd_list_element *info_record_cmdlist = NULL; struct target_ops * find_record_target (void) { - return find_target_at (record_stratum); + return current_inferior ()->target_at (record_stratum); } /* Check that recording is active. Throw an error, if it isn't. */ diff --git a/gdb/svr4-tls-tdep.c b/gdb/svr4-tls-tdep.c index 1f36d573b0c..a898299e948 100644 --- a/gdb/svr4-tls-tdep.c +++ b/gdb/svr4-tls-tdep.c @@ -123,7 +123,7 @@ svr4_tls_get_thread_local_address (struct gdbarch *gdbarch, ptid_t ptid, The idea here is to prefer use of of the target's thread_stratum method since it should be more accurate. */ if (gdbarch_data->get_tls_dtv_addr == nullptr - || (find_target_at (thread_stratum) != nullptr + || (current_inferior ()->target_at (thread_stratum) != nullptr && !force_internal_tls_address_lookup)) { struct target_ops *target = current_inferior ()->top_target (); diff --git a/gdb/target.c b/gdb/target.c index 641ec1d7e72..05944319e26 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -2950,12 +2950,10 @@ target_ops::info_proc (const char *args, enum info_proc_what what) int target_info_proc (const char *args, enum info_proc_what what) { - struct target_ops *t; - /* If we're already connected to something that can get us OS related data, use it. Otherwise, try using the native target. */ - t = find_target_at (process_stratum); + target_ops *t = current_inferior ()->target_at (process_stratum); if (t == NULL) t = find_default_run_target (NULL); @@ -3001,12 +2999,10 @@ target_supports_multi_process (void) std::optional target_get_osdata (const char *type) { - struct target_ops *t; - /* If we're already connected to something that can get us OS related data, use it. Otherwise, try using the native target. */ - t = find_target_at (process_stratum); + target_ops *t = current_inferior ()->target_at (process_stratum); if (t == NULL) t = find_default_run_target ("get OS data"); @@ -3079,11 +3075,9 @@ target_can_run () static struct target_ops * default_fileio_target (void) { - struct target_ops *t; - /* If we're already connected to something that can perform file I/O, use it. Otherwise, try using the native target. */ - t = find_target_at (process_stratum); + target_ops *t = current_inferior ()->target_at (process_stratum); if (t != NULL) return t; return find_default_run_target ("file I/O"); @@ -3597,16 +3591,6 @@ target_stack::find_beneath (const target_ops *t) const return NULL; } -/* See target.h. */ - -struct target_ops * -find_target_at (enum strata stratum) -{ - return current_inferior ()->target_at (stratum); -} - - - /* See target.h */ void diff --git a/gdb/target.h b/gdb/target.h index 2fd70cc9dfa..bf35227b658 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -2569,11 +2569,6 @@ extern void initialize_targets (void); extern void target_require_runnable (void); -/* Find the target at STRATUM. If no target is at that stratum, - return NULL. */ - -struct target_ops *find_target_at (enum strata stratum); - /* Read OS data object of type TYPE from the target, and return it in XML format. The return value follows the same rules as target_read_stralloc. */