[Pdbg] [PATCH 10/14] libpdbg/p9chip.c: allow sreset on running threads

Nicholas Piggin npiggin at gmail.com
Mon Apr 9 17:35:18 AEST 2018


Have sreset stop threads rather than require it only be used on threads
already stopped. This makes it friendlier to use, and fewer pdbg steps.
There is some indication that the sreset control works on running
threads, but testing has so far proven otherwise, so stop them if
they were not stopped.

Signed-off-by: Nicholas Piggin <npiggin at mgail.com>
---
 libpdbg/p9chip.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libpdbg/p9chip.c b/libpdbg/p9chip.c
index 684975a..2c6069a 100644
--- a/libpdbg/p9chip.c
+++ b/libpdbg/p9chip.c
@@ -140,8 +140,10 @@ static int p9_thread_step(struct thread *thread, int count)
 static int p9_thread_sreset(struct thread *thread)
 {
 	/* Can only sreset if a thread is inactive */
-	if (p9_get_thread_status(thread) != (THREAD_STATUS_QUIESCE | THREAD_STATUS_ACTIVE))
-		return 1;
+	if (p9_get_thread_status(thread) != (THREAD_STATUS_QUIESCE | THREAD_STATUS_ACTIVE)) {
+		if (p9_thread_stop(thread))
+			return 1;
+	}
 
 	thread_write(thread, P9_DIRECT_CONTROL, PPC_BIT(4 + 8*thread->id));
 
-- 
2.17.0



More information about the Pdbg mailing list