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 <tom@tromey.com>
This commit is contained in:
Simon Marchi
2025-12-02 16:09:26 -05:00
committed by Simon Marchi
parent 4e80f6037f
commit 390dbc4a87
4 changed files with 5 additions and 26 deletions

View 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. */

View 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 ();

View 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);
}
/* See target.h */
void

View 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. */