* [PATCH 0/2] misc: Improve error reporting on Windows
@ 2020-02-27 10:02 Philippe Mathieu-Daudé
2020-02-27 10:02 ` [PATCH 1/2] chardev: Improve error report by calling error_setg_win32() Philippe Mathieu-Daudé
2020-02-27 10:02 ` [PATCH 2/2] util/oslib-win32: " Philippe Mathieu-Daudé
0 siblings, 2 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-02-27 10:02 UTC (permalink / raw)
To: qemu-devel
Cc: Daniel P . Berrange, qemu-trivial, Stefan Weil, Paolo Bonzini,
Marc-André Lureau, Philippe Mathieu-Daudé
Two patches to improve bug reports on Windows.
(i.e. https://bugs.launchpad.net/qemu/+bug/1657841)
Philippe Mathieu-Daudé (2):
chardev: Improve error report by calling error_setg_win32()
util/oslib-win32: Improve error report by calling error_setg_win32()
chardev/char-pipe.c | 2 +-
chardev/char-win.c | 2 +-
util/oslib-win32.c | 3 ++-
3 files changed, 4 insertions(+), 3 deletions(-)
--
2.21.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/2] chardev: Improve error report by calling error_setg_win32()
2020-02-27 10:02 [PATCH 0/2] misc: Improve error reporting on Windows Philippe Mathieu-Daudé
@ 2020-02-27 10:02 ` Philippe Mathieu-Daudé
2020-02-27 10:23 ` Daniel P. Berrangé
2020-02-27 10:27 ` Marc-André Lureau
2020-02-27 10:02 ` [PATCH 2/2] util/oslib-win32: " Philippe Mathieu-Daudé
1 sibling, 2 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-02-27 10:02 UTC (permalink / raw)
To: qemu-devel
Cc: Daniel P . Berrange, qemu-trivial, Stefan Weil, Paolo Bonzini,
Marc-André Lureau, Philippe Mathieu-Daudé
Use error_setg_win32() which adds a hint similar to strerror(errno)).
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
chardev/char-pipe.c | 2 +-
chardev/char-win.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/chardev/char-pipe.c b/chardev/char-pipe.c
index 94d714ffcd..fd12c9e63b 100644
--- a/chardev/char-pipe.c
+++ b/chardev/char-pipe.c
@@ -70,7 +70,7 @@ static int win_chr_pipe_init(Chardev *chr, const char *filename,
MAXCONNECT, NSENDBUF, NRECVBUF, NTIMEOUT, NULL);
g_free(openname);
if (s->file == INVALID_HANDLE_VALUE) {
- error_setg(errp, "Failed CreateNamedPipe (%lu)", GetLastError());
+ error_setg_win32(errp, GetLastError(), "Failed CreateNamedPipe");
s->file = NULL;
goto fail;
}
diff --git a/chardev/char-win.c b/chardev/char-win.c
index 34825f683d..d4fb44c4dc 100644
--- a/chardev/char-win.c
+++ b/chardev/char-win.c
@@ -96,7 +96,7 @@ int win_chr_serial_init(Chardev *chr, const char *filename, Error **errp)
s->file = CreateFile(filename, GENERIC_READ | GENERIC_WRITE, 0, NULL,
OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0);
if (s->file == INVALID_HANDLE_VALUE) {
- error_setg(errp, "Failed CreateFile (%lu)", GetLastError());
+ error_setg_win32(errp, GetLastError(), "Failed CreateFile");
s->file = NULL;
goto fail;
}
--
2.21.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/2] util/oslib-win32: Improve error report by calling error_setg_win32()
2020-02-27 10:02 [PATCH 0/2] misc: Improve error reporting on Windows Philippe Mathieu-Daudé
2020-02-27 10:02 ` [PATCH 1/2] chardev: Improve error report by calling error_setg_win32() Philippe Mathieu-Daudé
@ 2020-02-27 10:02 ` Philippe Mathieu-Daudé
2020-02-27 10:21 ` Daniel P. Berrangé
2020-02-27 14:42 ` Markus Armbruster
1 sibling, 2 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-02-27 10:02 UTC (permalink / raw)
To: qemu-devel
Cc: Daniel P . Berrange, qemu-trivial, Stefan Weil, Paolo Bonzini,
Marc-André Lureau, Philippe Mathieu-Daudé
Use error_setg_win32() which adds a hint similar to strerror(errno)).
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
util/oslib-win32.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/util/oslib-win32.c b/util/oslib-win32.c
index e9b14ab178..d2fca1808d 100644
--- a/util/oslib-win32.c
+++ b/util/oslib-win32.c
@@ -46,7 +46,8 @@
void *qemu_oom_check(void *ptr)
{
if (ptr == NULL) {
- fprintf(stderr, "Failed to allocate memory: %lu\n", GetLastError());
+ g_autofree gchar *emsg = g_win32_error_message(GetLastError());
+ fprintf(stderr, "Failed to allocate memory: %s\n", emsg);
abort();
}
return ptr;
--
2.21.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] util/oslib-win32: Improve error report by calling error_setg_win32()
2020-02-27 10:02 ` [PATCH 2/2] util/oslib-win32: " Philippe Mathieu-Daudé
@ 2020-02-27 10:21 ` Daniel P. Berrangé
2020-02-27 14:42 ` Markus Armbruster
1 sibling, 0 replies; 8+ messages in thread
From: Daniel P. Berrangé @ 2020-02-27 10:21 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-trivial, Stefan Weil, qemu-devel, Marc-André Lureau,
Paolo Bonzini
On Thu, Feb 27, 2020 at 11:02:50AM +0100, Philippe Mathieu-Daudé wrote:
> Use error_setg_win32() which adds a hint similar to strerror(errno)).
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> util/oslib-win32.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] chardev: Improve error report by calling error_setg_win32()
2020-02-27 10:02 ` [PATCH 1/2] chardev: Improve error report by calling error_setg_win32() Philippe Mathieu-Daudé
@ 2020-02-27 10:23 ` Daniel P. Berrangé
2020-02-27 10:27 ` Marc-André Lureau
1 sibling, 0 replies; 8+ messages in thread
From: Daniel P. Berrangé @ 2020-02-27 10:23 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-trivial, Marc-André Lureau, Paolo Bonzini, qemu-devel,
Stefan Weil
On Thu, Feb 27, 2020 at 11:02:49AM +0100, Philippe Mathieu-Daudé wrote:
> Use error_setg_win32() which adds a hint similar to strerror(errno)).
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> chardev/char-pipe.c | 2 +-
> chardev/char-win.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] chardev: Improve error report by calling error_setg_win32()
2020-02-27 10:02 ` [PATCH 1/2] chardev: Improve error report by calling error_setg_win32() Philippe Mathieu-Daudé
2020-02-27 10:23 ` Daniel P. Berrangé
@ 2020-02-27 10:27 ` Marc-André Lureau
1 sibling, 0 replies; 8+ messages in thread
From: Marc-André Lureau @ 2020-02-27 10:27 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-trivial, Stefan Weil, Daniel P . Berrange, qemu-devel,
Paolo Bonzini
On Thu, Feb 27, 2020 at 11:03 AM Philippe Mathieu-Daudé
<philmd@redhat.com> wrote:
>
> Use error_setg_win32() which adds a hint similar to strerror(errno)).
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> chardev/char-pipe.c | 2 +-
> chardev/char-win.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/chardev/char-pipe.c b/chardev/char-pipe.c
> index 94d714ffcd..fd12c9e63b 100644
> --- a/chardev/char-pipe.c
> +++ b/chardev/char-pipe.c
> @@ -70,7 +70,7 @@ static int win_chr_pipe_init(Chardev *chr, const char *filename,
> MAXCONNECT, NSENDBUF, NRECVBUF, NTIMEOUT, NULL);
> g_free(openname);
> if (s->file == INVALID_HANDLE_VALUE) {
> - error_setg(errp, "Failed CreateNamedPipe (%lu)", GetLastError());
> + error_setg_win32(errp, GetLastError(), "Failed CreateNamedPipe");
> s->file = NULL;
> goto fail;
> }
> diff --git a/chardev/char-win.c b/chardev/char-win.c
> index 34825f683d..d4fb44c4dc 100644
> --- a/chardev/char-win.c
> +++ b/chardev/char-win.c
> @@ -96,7 +96,7 @@ int win_chr_serial_init(Chardev *chr, const char *filename, Error **errp)
> s->file = CreateFile(filename, GENERIC_READ | GENERIC_WRITE, 0, NULL,
> OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0);
> if (s->file == INVALID_HANDLE_VALUE) {
> - error_setg(errp, "Failed CreateFile (%lu)", GetLastError());
> + error_setg_win32(errp, GetLastError(), "Failed CreateFile");
> s->file = NULL;
> goto fail;
> }
> --
> 2.21.1
>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Daniel, do you mind queuing this with the qio patch?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] util/oslib-win32: Improve error report by calling error_setg_win32()
2020-02-27 10:02 ` [PATCH 2/2] util/oslib-win32: " Philippe Mathieu-Daudé
2020-02-27 10:21 ` Daniel P. Berrangé
@ 2020-02-27 14:42 ` Markus Armbruster
2020-02-27 15:35 ` Philippe Mathieu-Daudé
1 sibling, 1 reply; 8+ messages in thread
From: Markus Armbruster @ 2020-02-27 14:42 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: Daniel P . Berrange, qemu-trivial, Stefan Weil, qemu-devel,
Paolo Bonzini, Marc-André Lureau
Philippe Mathieu-Daudé <philmd@redhat.com> writes:
> Use error_setg_win32() which adds a hint similar to strerror(errno)).
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> util/oslib-win32.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/util/oslib-win32.c b/util/oslib-win32.c
> index e9b14ab178..d2fca1808d 100644
> --- a/util/oslib-win32.c
> +++ b/util/oslib-win32.c
> @@ -46,7 +46,8 @@
> void *qemu_oom_check(void *ptr)
> {
> if (ptr == NULL) {
> - fprintf(stderr, "Failed to allocate memory: %lu\n", GetLastError());
> + g_autofree gchar *emsg = g_win32_error_message(GetLastError());
Since we're on a path to abort(), I wouldn't bother with g_autofree.
> + fprintf(stderr, "Failed to allocate memory: %s\n", emsg);
Any particular reason not to use error_report()?
> abort();
> }
> return ptr;
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] util/oslib-win32: Improve error report by calling error_setg_win32()
2020-02-27 14:42 ` Markus Armbruster
@ 2020-02-27 15:35 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-02-27 15:35 UTC (permalink / raw)
To: Markus Armbruster
Cc: Daniel P . Berrange, qemu-trivial, Stefan Weil, qemu-devel,
Paolo Bonzini, Marc-André Lureau
On 2/27/20 3:42 PM, Markus Armbruster wrote:
> Philippe Mathieu-Daudé <philmd@redhat.com> writes:
>
>> Use error_setg_win32() which adds a hint similar to strerror(errno)).
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> ---
>> util/oslib-win32.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/util/oslib-win32.c b/util/oslib-win32.c
>> index e9b14ab178..d2fca1808d 100644
>> --- a/util/oslib-win32.c
>> +++ b/util/oslib-win32.c
>> @@ -46,7 +46,8 @@
>> void *qemu_oom_check(void *ptr)
>> {
>> if (ptr == NULL) {
>> - fprintf(stderr, "Failed to allocate memory: %lu\n", GetLastError());
>> + g_autofree gchar *emsg = g_win32_error_message(GetLastError());
>
> Since we're on a path to abort(), I wouldn't bother with g_autofree.\
This is in case other developers copy that elsewhere.
>
>> + fprintf(stderr, "Failed to allocate memory: %s\n", emsg);
>
> Any particular reason not to use error_report()?
Pre-existing call, but I can change.
>
>> abort();
>> }
>> return ptr;
>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2020-02-27 15:36 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-27 10:02 [PATCH 0/2] misc: Improve error reporting on Windows Philippe Mathieu-Daudé
2020-02-27 10:02 ` [PATCH 1/2] chardev: Improve error report by calling error_setg_win32() Philippe Mathieu-Daudé
2020-02-27 10:23 ` Daniel P. Berrangé
2020-02-27 10:27 ` Marc-André Lureau
2020-02-27 10:02 ` [PATCH 2/2] util/oslib-win32: " Philippe Mathieu-Daudé
2020-02-27 10:21 ` Daniel P. Berrangé
2020-02-27 14:42 ` Markus Armbruster
2020-02-27 15:35 ` Philippe Mathieu-Daudé
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).