[PATCH v4.5 26/29] gdbstub: Remove gdb_do_syscallv

Richard Henderson posted 29 patches 2 years, 11 months ago
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, "Alex Bennée" <alex.bennee@linaro.org>, Thomas Huth <thuth@redhat.com>, Eduardo Habkost <eduardo@habkost.net>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Yanan Wang <wangyanan55@huawei.com>, Daniel Henrique Barboza <danielhb413@gmail.com>, "Cédric Le Goater" <clg@kaod.org>, David Gibson <david@gibson.dropbear.id.au>, Greg Kurz <groug@kaod.org>, Laurent Vivier <laurent@vivier.eu>, Alexandre Iooss <erdnaxe@crans.org>, Mahmoud Mandour <ma.mandourr@gmail.com>, John Snow <jsnow@redhat.com>, Cleber Rosa <crosa@redhat.com>, Peter Maydell <peter.maydell@linaro.org>, Michael Rolnik <mrolnik@gmail.com>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, Taylor Simpson <tsimpson@quicinc.com>, Sunil Muthuswamy <sunilmut@microsoft.com>, Song Gao <gaosong@loongson.cn>, Xiaojuan Yang <yangxiaojuan@loongson.cn>, Aurelien Jarno <aurelien@aurel32.net>, Jiaxun Yang <jiaxun.yang@flygoat.com>, Aleksandar Rikalo <aleksandar.rikalo@syrmia.com>, Chris Wulff <crwulff@gmail.com>, Marek Vasut <marex@denx.de>, Stafford Horne <shorne@gmail.com>, Palmer Dabbelt <palmer@dabbelt.com>, Alistair Francis <alistair.francis@wdc.com>, Bin Meng <bin.meng@windriver.com>, Weiwei Li <liweiwei@iscas.ac.cn>, Liu Zhiwei <zhiwei_liu@linux.alibaba.com>, Yoshinori Sato <ysato@users.sourceforge.jp>, David Hildenbrand <david@redhat.com>, Ilya Leoshkevich <iii@linux.ibm.com>, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>, Artyom Tarasenko <atar4qemu@gmail.com>, Bastian Koppelmann <kbastian@mail.uni-paderborn.de>, Max Filippov <jcmvbkbc@gmail.com>
There is a newer version of this series
[PATCH v4.5 26/29] gdbstub: Remove gdb_do_syscallv
Posted by Richard Henderson 2 years, 11 months ago
This function is unused, except to implement gdb_do_syscall.
Fold the implementations together.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 include/gdbstub/syscalls.h | 11 -----------
 gdbstub/syscalls.c         | 26 ++++++++++----------------
 2 files changed, 10 insertions(+), 27 deletions(-)

diff --git a/include/gdbstub/syscalls.h b/include/gdbstub/syscalls.h
index 5851a2c706..243eaf8ce4 100644
--- a/include/gdbstub/syscalls.h
+++ b/include/gdbstub/syscalls.h
@@ -91,17 +91,6 @@ typedef void (*gdb_syscall_complete_cb)(CPUState *cpu, uint64_t ret, int err);
  */
 void gdb_do_syscall(gdb_syscall_complete_cb cb, const char *fmt, ...);
 
-/**
- * gdb_do_syscallv:
- * @cb: function to call when the system call has completed
- * @fmt: gdb syscall format string
- * @va: arguments to interpolate into @fmt
- *
- * As gdb_do_syscall, but taking a va_list rather than a variable
- * argument list.
- */
-void gdb_do_syscallv(gdb_syscall_complete_cb cb, const char *fmt, va_list va);
-
 /**
  * use_gdb_syscalls() - report if GDB should be used for syscalls
  *
diff --git a/gdbstub/syscalls.c b/gdbstub/syscalls.c
index 0a48f58d70..af42e244f9 100644
--- a/gdbstub/syscalls.c
+++ b/gdbstub/syscalls.c
@@ -92,24 +92,26 @@ bool gdb_handled_syscall(void)
  *   %lx - 64-bit argument printed in hex.
  *   %s  - string pointer (target_ulong) and length (int) pair.
  */
-void gdb_do_syscallv(gdb_syscall_complete_cb cb, const char *fmt, va_list va)
+void gdb_do_syscall(gdb_syscall_complete_cb cb, const char *fmt, ...)
 {
-    char *p;
-    char *p_end;
-    target_ulong addr;
-    uint64_t i64;
+    char *p, *p_end;
+    va_list va;
 
     if (!gdb_attached()) {
         return;
     }
 
     gdbserver_syscall_state.current_syscall_cb = cb;
+    va_start(va, fmt);
 
-    p = &gdbserver_syscall_state.syscall_buf[0];
-    p_end = &gdbserver_syscall_state.syscall_buf[sizeof(gdbserver_syscall_state.syscall_buf)];
+    p = gdbserver_syscall_state.syscall_buf;
+    p_end = p + sizeof(gdbserver_syscall_state.syscall_buf);
     *(p++) = 'F';
     while (*fmt) {
         if (*fmt == '%') {
+            target_ulong addr;
+            uint64_t i64;
+
             fmt++;
             switch (*fmt++) {
             case 'x':
@@ -140,16 +142,8 @@ void gdb_do_syscallv(gdb_syscall_complete_cb cb, const char *fmt, va_list va)
     }
     *p = 0;
 
-    gdb_syscall_handling(gdbserver_syscall_state.syscall_buf);
-}
-
-void gdb_do_syscall(gdb_syscall_complete_cb cb, const char *fmt, ...)
-{
-    va_list va;
-
-    va_start(va, fmt);
-    gdb_do_syscallv(cb, fmt, va);
     va_end(va);
+    gdb_syscall_handling(gdbserver_syscall_state.syscall_buf);
 }
 
 /*
-- 
2.34.1
Re: [PATCH v4.5 26/29] gdbstub: Remove gdb_do_syscallv
Posted by Philippe Mathieu-Daudé 2 years, 11 months ago
On 3/3/23 03:58, Richard Henderson wrote:
> This function is unused, except to implement gdb_do_syscall.
> Fold the implementations together.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   include/gdbstub/syscalls.h | 11 -----------
>   gdbstub/syscalls.c         | 26 ++++++++++----------------
>   2 files changed, 10 insertions(+), 27 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>