mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-23 18:14:13 +08:00
introduce and use find_target_at
This patch adds find_target_at to determine whether a target appears at a given stratum. This new function lets us clean up find_record_target a bit, and is generally useful. 2014-02-19 Tom Tromey <tromey@redhat.com> * record.c (find_record_target): Use find_target_at. * target.c (find_target_at): New function. * target.h (find_target_at): Declare.
This commit is contained in:
parent
6a109b6b2c
commit
8b06beed0f
@ -1,3 +1,9 @@
|
||||
2014-02-19 Tom Tromey <tromey@redhat.com>
|
||||
|
||||
* record.c (find_record_target): Use find_target_at.
|
||||
* target.c (find_target_at): New function.
|
||||
* target.h (find_target_at): Declare.
|
||||
|
||||
2014-02-19 Tom Tromey <tromey@redhat.com>
|
||||
|
||||
* aarch64-linux-nat.c (aarch64_linux_stopped_by_watchpoint):
|
||||
|
@ -62,13 +62,7 @@ struct cmd_list_element *info_record_cmdlist = NULL;
|
||||
struct target_ops *
|
||||
find_record_target (void)
|
||||
{
|
||||
struct target_ops *t;
|
||||
|
||||
for (t = current_target.beneath; t != NULL; t = t->beneath)
|
||||
if (t->to_stratum == record_stratum)
|
||||
return t;
|
||||
|
||||
return NULL;
|
||||
return find_target_at (record_stratum);
|
||||
}
|
||||
|
||||
/* Check that recording is active. Throw an error, if it isn't. */
|
||||
|
14
gdb/target.c
14
gdb/target.c
@ -3748,6 +3748,20 @@ find_target_beneath (struct target_ops *t)
|
||||
return t->beneath;
|
||||
}
|
||||
|
||||
/* See target.h. */
|
||||
|
||||
struct target_ops *
|
||||
find_target_at (enum strata stratum)
|
||||
{
|
||||
struct target_ops *t;
|
||||
|
||||
for (t = current_target.beneath; t != NULL; t = t->beneath)
|
||||
if (t->to_stratum == stratum)
|
||||
return t;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* The inferior process has died. Long live the inferior! */
|
||||
|
||||
|
@ -1968,6 +1968,11 @@ extern void find_default_create_inferior (struct target_ops *,
|
||||
|
||||
extern struct target_ops *find_target_beneath (struct target_ops *);
|
||||
|
||||
/* 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 result is NUL-terminated and returned as a string,
|
||||
allocated using xmalloc. If an error occurs or the transfer is
|
||||
|
Loading…
Reference in New Issue
Block a user