[Pdbg] [PATCH] libpdbg: Add an interface to probe all targets
Alistair Popple
alistair at popple.id.au
Wed May 2 10:49:10 AEST 2018
The move to lazy probing in 983ae86 ("libpdbg: Lazy probing") requires
users of particular targets to explicitly probe them if they are required.
This is not possible for all users so as a convenience add an interface to
probe all known targets.
Signed-off-by: Alistair Popple <alistair at popple.id.au>
---
libpdbg/libpdbg.h | 1 +
libpdbg/target.c | 11 +++++++++++
2 files changed, 12 insertions(+)
diff --git a/libpdbg/libpdbg.h b/libpdbg/libpdbg.h
index f843816..648a8b1 100644
--- a/libpdbg/libpdbg.h
+++ b/libpdbg/libpdbg.h
@@ -62,6 +62,7 @@ uint64_t pdbg_get_address(struct pdbg_target *target, uint64_t *size);
/* Misc. */
void pdbg_targets_init(void *fdt);
+void pdbg_target_probe_all(void);
enum pdbg_target_status pdbg_target_probe(struct pdbg_target *target);
enum pdbg_target_status pdbg_target_status(struct pdbg_target *target);
void pdbg_target_status_set(struct pdbg_target *target, enum pdbg_target_status status);
diff --git a/libpdbg/target.c b/libpdbg/target.c
index 704d7d5..bd4fab6 100644
--- a/libpdbg/target.c
+++ b/libpdbg/target.c
@@ -334,6 +334,17 @@ enum pdbg_target_status pdbg_target_probe(struct pdbg_target *target)
return PDBG_TARGET_ENABLED;
}
+/*
+ * Probe all targets in the device tree.
+ */
+void pdbg_target_probe_all(void)
+{
+ struct pdbg_target *target;
+
+ pdbg_for_each_child_target(dt_root, target)
+ pdbg_target_probe(target);
+}
+
bool pdbg_target_is_class(struct pdbg_target *target, const char *class)
{
if (!target || !target->class || !class)
--
2.11.0
More information about the Pdbg
mailing list