[Pdbg] [PATCH] libpdbg: Ensure threads are probed prior to setup in ram_setup

Alistair Popple alistair at popple.id.au
Thu Aug 9 17:37:51 AEST 2018


p9chip.c called the probe function directly. Better to call pdbg_target_probe()
so that any intermediate targets can also be probed.

p8chip.c didn't probe the threads at all prior to use, so do that.

Signed-off-by: Alistair Popple <alistair at popple.id.au>
---
 libpdbg/p8chip.c | 6 ++++++
 libpdbg/p9chip.c | 4 +++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/libpdbg/p8chip.c b/libpdbg/p8chip.c
index 3e90c8d..2638725 100644
--- a/libpdbg/p8chip.c
+++ b/libpdbg/p8chip.c
@@ -300,6 +300,12 @@ static int p8_ram_setup(struct thread *thread)
 	 * quiesced */
 	dt_for_each_compatible(&chip->target, target, "ibm,power8-thread") {
 		struct thread *tmp;
+
+		/* If this thread wasn't enabled it may not yet have been probed
+		   so do that now. This will also update the thread status */
+		if (pdbg_target_probe(target) != PDBG_TARGET_ENABLED)
+			return 1;
+
 		tmp = target_to_thread(target);
 		if (!(get_thread_status(tmp).quiesced))
 			return 1;
diff --git a/libpdbg/p9chip.c b/libpdbg/p9chip.c
index 1433d19..dcdb69d 100644
--- a/libpdbg/p9chip.c
+++ b/libpdbg/p9chip.c
@@ -227,7 +227,9 @@ static int p9_ram_setup(struct thread *thread)
 
 		/* If this thread wasn't enabled it may not yet have been probed
 		   so do that now. This will also update the thread status */
-		p9_thread_probe(target);
+		if (pdbg_target_probe(target) != PDBG_TARGET_ENABLED)
+			goto out_fail;
+
 		tmp = target_to_thread(target);
 		if (!(tmp->status.quiesced))
 			goto out_fail;
-- 
2.11.0



More information about the Pdbg mailing list