[Qemu-devel] [PATCH v2] util/error: do not free error on error_abort

Vladimir Sementsov-Ogievskiy posted 1 patch 9 weeks ago
Test docker-mingw@fedora passed
Test docker-clang@ubuntu passed
Test checkpatch passed
Test asan passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20190415142519.73060-1-vsementsov@virtuozzo.com
Maintainers: Markus Armbruster <armbru@redhat.com>
util/error.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

[Qemu-devel] [PATCH v2] util/error: do not free error on error_abort

Posted by Vladimir Sementsov-Ogievskiy 9 weeks ago
It would be nice to have Error object not freed away when debugging a
coredump.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---

v2: don't change error output format

 util/error.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/util/error.c b/util/error.c
index 934a78e1b1..22f8a7924f 100644
--- a/util/error.c
+++ b/util/error.c
@@ -34,7 +34,10 @@ static void error_handle_fatal(Error **errp, Error *err)
     if (errp == &error_abort) {
         fprintf(stderr, "Unexpected error in %s() at %s:%d:\n",
                 err->func, err->src, err->line);
-        error_report_err(err);
+        error_report("%s", error_get_pretty(err));
+        if (err->hint) {
+            error_printf_unless_qmp("%s", err->hint->str);
+        }
         abort();
     }
     if (errp == &error_fatal) {
-- 
2.18.0


Re: [Qemu-devel] [PATCH v2] util/error: do not free error on error_abort

Posted by Markus Armbruster 8 weeks ago
Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> writes:

> It would be nice to have Error object not freed away when debugging a
> coredump.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
>
> v2: don't change error output format
>
>  util/error.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/util/error.c b/util/error.c
> index 934a78e1b1..22f8a7924f 100644
> --- a/util/error.c
> +++ b/util/error.c
> @@ -34,7 +34,10 @@ static void error_handle_fatal(Error **errp, Error *err)
>      if (errp == &error_abort) {
>          fprintf(stderr, "Unexpected error in %s() at %s:%d:\n",
>                  err->func, err->src, err->line);
> -        error_report_err(err);
> +        error_report("%s", error_get_pretty(err));
> +        if (err->hint) {
> +            error_printf_unless_qmp("%s", err->hint->str);
> +        }
>          abort();
>      }
>      if (errp == &error_fatal) {

We've since found out that the hint should be printed with
error_printf(), see "[PATCH] error: Fix error_report_err(),
warn_report_err() hint printing".  With that:

Reviewed-by: Markus Armbruster <armbru@redhat.com>

Queued with this change.  Thanks!