[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 10/37] system: propagate Error to gdbserver_start (and oth
From: |
Ilya Leoshkevich |
Subject: |
Re: [PATCH v2 10/37] system: propagate Error to gdbserver_start (and other device setups) |
Date: |
Tue, 14 Jan 2025 22:45:42 +0100 |
User-agent: |
Evolution 3.52.4 (3.52.4-2.fc40) |
On Tue, 2025-01-14 at 11:37 +0000, Alex Bennée wrote:
> This started as a clean-up to properly pass a Error handler to the
> gdbserver_start so we could do the right thing for command line and
> HMP invocations.
>
> Now that we have cleaned up foreach_device_config_or_exit() in
> earlier
> patches we can further simplify by it by passing &error_fatal instead
> of checking the return value. Having a return value is still useful
> for HMP though so tweak the return to use a simple bool instead.
>
> Message-Id: <20250109170619.2271193-11-alex.bennee@linaro.org>
> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> Acked-by: Ilya Leoshkevich <iii@linux.ibm.com>
Apparently the BSD code needs to be adjusted:
../qemu/bsd-user/main.c:631:32: error: too few arguments to function
call, expected 2, have 1
631 | gdbserver_start(gdbstub);
| ~~~~~~~~~~~~~~~ ^
/home/user/qemu/include/exec/gdbstub.h:63:6: note: 'gdbserver_start'
declared here
63 | bool gdbserver_start(const char *port_or_device, Error **errp);
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
> ---
> v2
> - split some work into pre-cursor patches
> ---
> include/exec/gdbstub.h | 8 +++++-
> gdbstub/system.c | 22 ++++++++--------
> gdbstub/user.c | 20 ++++++++-------
> linux-user/main.c | 6 +----
> monitor/hmp-cmds.c | 2 +-
> system/vl.c | 58 ++++++++++++++++++++--------------------
> --
> 6 files changed, 59 insertions(+), 57 deletions(-)
[...]
> diff --git a/gdbstub/user.c b/gdbstub/user.c
> index 0b4bfa9c48..fb8f6867ea 100644
> --- a/gdbstub/user.c
> +++ b/gdbstub/user.c
> @@ -13,6 +13,7 @@
> #include "qemu/bitops.h"
> #include "qemu/cutils.h"
> #include "qemu/sockets.h"
> +#include "qapi/error.h"
> #include "exec/hwaddr.h"
> #include "exec/tb-flush.h"
> #include "exec/gdbstub.h"
> @@ -372,15 +373,15 @@ static bool gdb_accept_tcp(int gdb_fd)
> return true;
> }
>
> -static int gdbserver_open_port(int port)
> +static int gdbserver_open_port(int port, Error **errp)
> {
> struct sockaddr_in sockaddr;
> int fd, ret;
>
> fd = socket(PF_INET, SOCK_STREAM, 0);
> if (fd < 0) {
> - perror("socket");
> - return -1;
> + error_setg(errp, "Failed to bind socket: %s",
> strerror(errno));
> + return false;
I think return -1 needs to stay here.
> }
> qemu_set_cloexec(fd);
[...]
- [PATCH v2 17/37] contrib/plugins/hotblocks: fix 32-bit build, (continued)
- [PATCH v2 17/37] contrib/plugins/hotblocks: fix 32-bit build, Alex Bennée, 2025/01/14
- [PATCH v2 15/37] contrib/plugins/stoptrigger: fix 32-bit build, Alex Bennée, 2025/01/14
- [PATCH v2 09/37] system: squash usb_parse into a single function, Alex Bennée, 2025/01/14
- [PATCH v2 34/37] docs/devel: add information on how to setup build environments, Alex Bennée, 2025/01/14
- [PATCH v2 06/37] semihosting/console: Avoid including 'cpu.h', Alex Bennée, 2025/01/14
- [PATCH v2 25/37] plugins: enable linking with clang/lld, Alex Bennée, 2025/01/14
- [PATCH v2 26/37] plugins: fix kdoc annotation, Alex Bennée, 2025/01/14
- [PATCH v2 35/37] docs: add a codebase section, Alex Bennée, 2025/01/14
- [PATCH v2 10/37] system: propagate Error to gdbserver_start (and other device setups), Alex Bennée, 2025/01/14
- Re: [PATCH v2 10/37] system: propagate Error to gdbserver_start (and other device setups),
Ilya Leoshkevich <=
- [PATCH v2 14/37] tests/tcg/plugins/mem: fix 32-bit build, Alex Bennée, 2025/01/14
- [PATCH v2 36/37] docs: add a glossary, Alex Bennée, 2025/01/14
- [PATCH v2 13/37] tests/tcg/plugins/syscall: fix 32-bit build, Alex Bennée, 2025/01/14
- [PATCH v2 33/37] docs/devel: add b4 for patch retrieval, Alex Bennée, 2025/01/14
- [PATCH v2 16/37] contrib/plugins/cache: fix 32-bit build, Alex Bennée, 2025/01/14
- [PATCH v2 11/37] tests/tcg/plugins/insn: remove unused callback parameter, Alex Bennée, 2025/01/14
- [PATCH v2 37/37] scripts/nsis.py: Run dependency check for each DLL file only once, Alex Bennée, 2025/01/14
- [PATCH v2 18/37] contrib/plugins/cflow: fix 32-bit build, Alex Bennée, 2025/01/14
- [PATCH v2 28/37] tests/qtest: fix some copy and paste errors in kdoc, Alex Bennée, 2025/01/14