[Pdbg] [PATCH 2/3] libpdbg: Replace thread control api with consistent naming

Amitay Isaacs amitay at ozlabs.org
Wed Jul 3 17:20:25 AEST 2019


Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
---
 libpdbg/chip.c    |  8 ++++----
 libpdbg/libpdbg.h | 17 ++++++++---------
 src/pdbgproxy.c   |  6 +++---
 src/thread.c      | 26 +++++++++++++-------------
 4 files changed, 28 insertions(+), 29 deletions(-)

diff --git a/libpdbg/chip.c b/libpdbg/chip.c
index 01185f6..9034cb6 100644
--- a/libpdbg/chip.c
+++ b/libpdbg/chip.c
@@ -118,7 +118,7 @@ struct thread_state thread_status(struct pdbg_target *target)
 /*
  * Single step the thread count instructions.
  */
-int ram_step_thread(struct pdbg_target *thread_target, int count)
+int thread_step(struct pdbg_target *thread_target, int count)
 {
 	struct thread *thread;
 
@@ -127,7 +127,7 @@ int ram_step_thread(struct pdbg_target *thread_target, int count)
 	return thread->step(thread, count);
 }
 
-int ram_start_thread(struct pdbg_target *thread_target)
+int thread_start(struct pdbg_target *thread_target)
 {
 	struct thread *thread;
 
@@ -136,7 +136,7 @@ int ram_start_thread(struct pdbg_target *thread_target)
 	return thread->start(thread);
 }
 
-int ram_stop_thread(struct pdbg_target *thread_target)
+int thread_stop(struct pdbg_target *thread_target)
 {
 	struct thread *thread;
 
@@ -145,7 +145,7 @@ int ram_stop_thread(struct pdbg_target *thread_target)
 	return thread->stop(thread);
 }
 
-int ram_sreset_thread(struct pdbg_target *thread_target)
+int thread_sreset(struct pdbg_target *thread_target)
 {
 	struct thread *thread;
 
diff --git a/libpdbg/libpdbg.h b/libpdbg/libpdbg.h
index ffc741a..9dd012d 100644
--- a/libpdbg/libpdbg.h
+++ b/libpdbg/libpdbg.h
@@ -181,15 +181,6 @@ int thread_getxer(struct pdbg_target *thread, uint64_t *value);
 int thread_putxer(struct pdbg_target *thread, uint64_t value);
 int thread_getregs(struct pdbg_target *target, struct thread_regs *regs);
 
-int ram_start_thread(struct pdbg_target *target);
-int ram_step_thread(struct pdbg_target *target, int steps);
-int ram_stop_thread(struct pdbg_target *target);
-int ram_sreset_thread(struct pdbg_target *target);
-int ram_state_thread(struct pdbg_target *target, struct thread_regs *regs);
-struct thread_state thread_status(struct pdbg_target *target);
-
-int getring(struct pdbg_target *chiplet_target, uint64_t ring_addr, uint64_t ring_len, uint32_t result[]);
-
 enum pdbg_sleep_state {PDBG_THREAD_STATE_RUN, PDBG_THREAD_STATE_DOZE,
 		       PDBG_THREAD_STATE_NAP, PDBG_THREAD_STATE_SLEEP,
 		       PDBG_THREAD_STATE_STOP};
@@ -203,6 +194,14 @@ struct thread_state {
 	enum pdbg_smt_state smt_state;
 };
 
+int thread_start(struct pdbg_target *target);
+int thread_step(struct pdbg_target *target, int steps);
+int thread_stop(struct pdbg_target *target);
+int thread_sreset(struct pdbg_target *target);
+struct thread_state thread_status(struct pdbg_target *target);
+
+int getring(struct pdbg_target *chiplet_target, uint64_t ring_addr, uint64_t ring_len, uint32_t result[]);
+
 int htm_start(struct pdbg_target *target);
 int htm_stop(struct pdbg_target *target);
 int htm_status(struct pdbg_target *target);
diff --git a/src/pdbgproxy.c b/src/pdbgproxy.c
index c16abc8..5bba03f 100644
--- a/src/pdbgproxy.c
+++ b/src/pdbgproxy.c
@@ -307,14 +307,14 @@ out:
 
 static void v_conts(uint64_t *stack, void *priv)
 {
-	ram_step_thread(thread_target, 1);
+	thread_step(thread_target, 1);
 	send_response(fd, TRAP);
 }
 
 #define VCONT_POLL_DELAY 100000
 static void v_contc(uint64_t *stack, void *priv)
 {
-	ram_start_thread(thread_target);
+	thread_start(thread_target);
 	state = SIGNAL_WAIT;
 	poll_interval = 1;
 }
@@ -322,7 +322,7 @@ static void v_contc(uint64_t *stack, void *priv)
 static void interrupt(uint64_t *stack, void *priv)
 {
 	PR_INFO("Interrupt\n");
-	ram_stop_thread(thread_target);
+	thread_stop(thread_target);
 	send_response(fd, TRAP);
 
 	return;
diff --git a/src/thread.c b/src/thread.c
index ede797a..7fd53a8 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -149,7 +149,7 @@ do_pc:
 	return 0;
 }
 
-static int thread_start(void)
+static int thr_start(void)
 {
 	struct pdbg_target *target;
 	int count = 0;
@@ -158,15 +158,15 @@ static int thread_start(void)
 		if (pdbg_target_status(target) != PDBG_TARGET_ENABLED)
 			continue;
 
-		ram_start_thread(target);
+		thread_start(target);
 		count++;
 	}
 
 	return count;
 }
-OPTCMD_DEFINE_CMD(start, thread_start);
+OPTCMD_DEFINE_CMD(start, thr_start);
 
-static int thread_step(uint64_t steps)
+static int thr_step(uint64_t steps)
 {
 	struct pdbg_target *target;
 	int count = 0;
@@ -175,15 +175,15 @@ static int thread_step(uint64_t steps)
 		if (pdbg_target_status(target) != PDBG_TARGET_ENABLED)
 			continue;
 
-		ram_step_thread(target, (int)steps);
+		thread_step(target, (int)steps);
 		count++;
 	}
 
 	return count;
 }
-OPTCMD_DEFINE_CMD_WITH_ARGS(step, thread_step, (DATA));
+OPTCMD_DEFINE_CMD_WITH_ARGS(step, thr_step, (DATA));
 
-static int thread_stop(void)
+static int thr_stop(void)
 {
 	struct pdbg_target *target;
 	int count = 0;
@@ -192,13 +192,13 @@ static int thread_stop(void)
 		if (pdbg_target_status(target) != PDBG_TARGET_ENABLED)
 			continue;
 
-		ram_stop_thread(target);
+		thread_stop(target);
 		count++;
 	}
 
 	return count;
 }
-OPTCMD_DEFINE_CMD(stop, thread_stop);
+OPTCMD_DEFINE_CMD(stop, thr_stop);
 
 
 static int print_one_thread(struct pdbg_target *thread)
@@ -295,7 +295,7 @@ static int thread_status_print(void)
 }
 OPTCMD_DEFINE_CMD(threadstatus, thread_status_print);
 
-static int thread_sreset(void)
+static int thr_sreset(void)
 {
 	struct pdbg_target *target;
 	int count = 0;
@@ -304,13 +304,13 @@ static int thread_sreset(void)
 		if (pdbg_target_status(target) != PDBG_TARGET_ENABLED)
 			continue;
 
-		ram_sreset_thread(target);
+		thread_sreset(target);
 		count++;
 	}
 
 	return count;
 }
-OPTCMD_DEFINE_CMD(sreset, thread_sreset);
+OPTCMD_DEFINE_CMD(sreset, thr_sreset);
 
 
 struct reg_flags {
@@ -334,7 +334,7 @@ static int thread_regs_print(struct reg_flags flags)
 		       pdbg_target_index(core),
 		       pdbg_target_index(thread));
 
-		if (ram_state_thread(thread, &regs))
+		if (thread_getregs(thread, &regs))
 			continue;
 
 		if (flags.do_backtrace) {
-- 
2.21.0



More information about the Pdbg mailing list