diff mbox series

[v2,12/38] libpdbg: thread_regs don't print regs

Message ID 20220329154931.493851-13-npiggin@gmail.com
State New
Headers show
Series gdbserver multi-threaded debugging and POWER9/10 support | expand

Commit Message

Nicholas Piggin March 29, 2022, 3:49 p.m. UTC
The gdbserver uses thread_getregs to send data to the client, printing
to console is noisy. Push the printing into callers that want it.

Reviewed-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 libpdbg/chip.c   | 2 --
 libpdbg/thread.c | 7 +------
 src/thread.c     | 2 ++
 3 files changed, 3 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/libpdbg/chip.c b/libpdbg/chip.c
index 79aeb35..6cbf48b 100644
--- a/libpdbg/chip.c
+++ b/libpdbg/chip.c
@@ -380,8 +380,6 @@  int ram_getregs(struct thread *thread, struct thread_regs *regs)
 
 	CHECK_ERR(thread->ram_destroy(thread));
 
-	thread_print_regs(regs);
-
 	return 0;
 }
 
diff --git a/libpdbg/thread.c b/libpdbg/thread.c
index 4a7523c..78a59b8 100644
--- a/libpdbg/thread.c
+++ b/libpdbg/thread.c
@@ -371,7 +371,6 @@  void thread_print_regs(struct thread_regs *regs)
 int thread_getregs(struct pdbg_target *target, struct thread_regs *regs)
 {
 	struct thread *thread;
-	int err;
 
 	assert(pdbg_target_is_class(target, "thread"));
 
@@ -385,11 +384,7 @@  int thread_getregs(struct pdbg_target *target, struct thread_regs *regs)
 		return -1;
 	}
 
-	err = thread->getregs(thread, regs);
-	if (!err)
-		thread_print_regs(regs);
-
-	return err;
+	return thread->getregs(thread, regs);
 }
 
 int thread_getgpr(struct pdbg_target *target, int gpr, uint64_t *value)
diff --git a/src/thread.c b/src/thread.c
index 8ddf4ae..76909d6 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -362,6 +362,8 @@  static int thread_regs_print(struct reg_flags flags)
 		if (thread_getregs(thread, &regs))
 			continue;
 
+		thread_print_regs(&regs);
+
 		if (flags.do_backtrace) {
 			struct pdbg_target *adu;