[Pdbg] [PATCH v4 03/13] libpdbg: sbe_istep should be called with pib target instead of sbefifo
Amitay Isaacs
amitay at ozlabs.org
Wed Jul 17 14:08:42 AEST 2019
This makes the api consistent with the rest of the libpdbg.
Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
---
libpdbg/target.c | 24 ++++++++++++++++++++++--
libpdbg/target.h | 2 ++
2 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/libpdbg/target.c b/libpdbg/target.c
index 4cf5491..f937bdf 100644
--- a/libpdbg/target.c
+++ b/libpdbg/target.c
@@ -273,13 +273,33 @@ int mem_write(uint64_t addr, uint8_t *input, uint64_t size, uint8_t block_size,
return rc;
}
+struct sbefifo *pib_to_sbefifo(struct pdbg_target *pib)
+{
+ struct pdbg_target *sbefifo;
+ uint32_t index;
+
+ assert(pdbg_target_is_class(pib, "pib"));
+ index = pdbg_target_index(pib);
+
+ pdbg_for_each_class_target("sbefifo", sbefifo) {
+ if (pdbg_target_index(sbefifo) == index)
+ continue;
+
+ if (pdbg_target_probe(sbefifo) == PDBG_TARGET_ENABLED)
+ return target_to_sbefifo(sbefifo);
+ }
+
+ return NULL;
+}
+
int sbe_istep(struct pdbg_target *target, uint32_t major, uint32_t minor)
{
struct sbefifo *sbefifo;
- assert(pdbg_target_is_class(target, "sbefifo"));
+ sbefifo = pib_to_sbefifo(target);
+ if (!sbefifo)
+ return -1;
- sbefifo = target_to_sbefifo(target);
return sbefifo->istep(sbefifo, major, minor);
}
diff --git a/libpdbg/target.h b/libpdbg/target.h
index 193c0e0..9394447 100644
--- a/libpdbg/target.h
+++ b/libpdbg/target.h
@@ -63,4 +63,6 @@ extern struct list_head target_classes;
const char *pdbg_get_backend_option(void);
+struct sbefifo *pib_to_sbefifo(struct pdbg_target *target);
+
#endif
--
2.21.0
More information about the Pdbg
mailing list