[Pdbg] [PATCH 3/4] pdbg: Call thread_<op>_all() api if all threads are selected

Amitay Isaacs amitay at ozlabs.org
Fri Aug 9 13:20:23 AEST 2019


This allows to optimize the thread operations (start/step/stop/sreset)
when using sbefifo backend.

Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
---
 src/thread.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/src/thread.c b/src/thread.c
index 7fd53a8..60d404b 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -154,6 +154,11 @@ static int thr_start(void)
 	struct pdbg_target *target;
 	int count = 0;
 
+	if (path_target_all_selected("thread", NULL)) {
+		thread_start_all();
+		return 1;
+	}
+
 	for_each_path_target_class("thread", target) {
 		if (pdbg_target_status(target) != PDBG_TARGET_ENABLED)
 			continue;
@@ -171,6 +176,15 @@ static int thr_step(uint64_t steps)
 	struct pdbg_target *target;
 	int count = 0;
 
+	if (path_target_all_selected("thread", NULL)) {
+		int i;
+
+		for (i=0; i<count; i++)
+			thread_step_all();
+
+		return 1;
+	}
+
 	for_each_path_target_class("thread", target) {
 		if (pdbg_target_status(target) != PDBG_TARGET_ENABLED)
 			continue;
@@ -188,6 +202,11 @@ static int thr_stop(void)
 	struct pdbg_target *target;
 	int count = 0;
 
+	if (path_target_all_selected("thread", NULL)) {
+		thread_stop_all();
+		return 1;
+	}
+
 	for_each_path_target_class("thread", target) {
 		if (pdbg_target_status(target) != PDBG_TARGET_ENABLED)
 			continue;
@@ -300,6 +319,11 @@ static int thr_sreset(void)
 	struct pdbg_target *target;
 	int count = 0;
 
+	if (path_target_all_selected("thread", NULL)) {
+		thread_sreset_all();
+		return 1;
+	}
+
 	for_each_path_target_class("thread", target) {
 		if (pdbg_target_status(target) != PDBG_TARGET_ENABLED)
 			continue;
-- 
2.21.0



More information about the Pdbg mailing list