[Pdbg] [PATCH v2 13/39] libpdbg: thread_regs don't print regs
Nicholas Piggin
npiggin at gmail.com
Wed Apr 20 16:49:47 AEST 2022
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 at jms.id.au>
Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
---
libpdbg/chip.c | 2 --
libpdbg/thread.c | 7 +------
src/thread.c | 2 ++
3 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/libpdbg/chip.c b/libpdbg/chip.c
index 79aeb359..6cbf48b0 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 4a7523c0..78a59b8b 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 8ddf4aeb..76909d67 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, ®s))
continue;
+ thread_print_regs(®s);
+
if (flags.do_backtrace) {
struct pdbg_target *adu;
--
2.35.1
More information about the Pdbg
mailing list