]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: remove find_target_at
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 2 Dec 2025 21:09:26 +0000 (16:09 -0500)
committerSimon Marchi <simon.marchi@polymtl.ca>
Thu, 4 Dec 2025 16:34:14 +0000 (11:34 -0500)
... 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 <tom@tromey.com>
gdb/record.c
gdb/svr4-tls-tdep.c
gdb/target.c
gdb/target.h

index 7f3cf541bf1ae4fc4a3e9c112412dfbf02d038ea..38bbfbeffff60647caa7c8759d0a0615fc670181 100644 (file)
@@ -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.  */
index 1f36d573b0c85fac534e57a6c9f40853b7490b5e..a898299e94867e95237258120bd771f68f50d9a3 100644 (file)
@@ -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 ();
index 641ec1d7e72aad0fd67101fe3b2d5c9dd437461b..05944319e260d2e52b425cfcc3c7f5f99a79d150 100644 (file)
@@ -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<gdb::char_vector>
 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);
-}
-
-\f
-
 /* See target.h  */
 
 void
index 2fd70cc9dfa2cafc6548a97c779b77dcadeb84a1..bf35227b6584c582a025c9941c1da99826dc0213 100644 (file)
@@ -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.  */