Skip to contentSkip to conversation

util/error: do not free error on error_abort

PATCH Applied Vladimir Sementsov-Ogievskiy 2 participants 2 messages Apr 15, 2019 – Apr 17, 2019

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 util/error: do not free error on error_abort

It would be nice to have Error object not freed away when debugging a coredump.

---

v2: don't change error output format

 util/error.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
util/error.c +4 -1
index 934a78e1b1..22f8a7924f 100644
@@ -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) {
Signature · 1 line
2.18.0
Reviewed-by on v2 1/1 Applied
#1 lore raw
Quoted 17 lines · Vladimir Sementsov-Ogievskiy

It would be nice to have Error object not freed away when debugging a coredump.

---

v2: don't change error output format

 util/error.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
util/error.c +0 -0
index 934a78e1b1..22f8a7924f 100644
@@ -34,7 +34,10 @@ static void error_handle_fatal(Error **errp, Error *err)
     if (errp == &error_abort) {

util/error.c static void error_handle_fatal(Error **errp, Error *err) · line 43

Quoted 10 lines
util/error.c +4 -1
         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:

Queued with this change. Thanks!