From 8b06beed0f0eb221067a1013add2efd159a36ade Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 28 Oct 2013 12:16:24 -0600 Subject: 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 * record.c (find_record_target): Use find_target_at. * target.c (find_target_at): New function. * target.h (find_target_at): Declare. --- gdb/target.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'gdb/target.c') diff --git a/gdb/target.c b/gdb/target.c index 990dc5e..75f7506 100644 --- a/gdb/target.c +++ b/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! */ -- cgit v1.1