qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v4 08/11] target/mips: Use error_report for UHI_assert


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH v4 08/11] target/mips: Use error_report for UHI_assert
Date: Fri, 10 Jun 2022 17:10:46 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.10.0

On 8/6/22 07:19, Richard Henderson wrote:
Always log the assert locally.  Do not report_fault, but
instead include the fact of the fault in the assertion.
Don't bother freeing allocated strings before the abort().

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
  target/mips/tcg/sysemu/mips-semi.c | 39 ++++++++++++++----------------
  1 file changed, 18 insertions(+), 21 deletions(-)

      case UHI_assert:
-        GET_TARGET_STRINGS_2(p, gpr[4], p2, gpr[5]);
-        printf("assertion '");
-        printf("\"%s\"", p);
-        printf("': file \"%s\", line %d\n", p2, (int)gpr[6]);
-        FREE_TARGET_STRING(p2, gpr[5]);
-        FREE_TARGET_STRING(p, gpr[4]);
-        abort();
-        break;
+        {
+            const char *msg, *file;
+
+            msg = lock_user_string(gpr[4]);
+            if (!msg) {
+                msg = "<EFAULT>";
+            }
+            file = lock_user_string(gpr[5]);
+            if (!file) {
+                file = "<EFAULT>";
+            }
+
+            error_report("UHI assertion \"%s\": file \"%s\", line %d",
+                         msg, file, (int)gpr[6]);
+            abort();
+        }
+
      default:
          error_report("Unknown UHI operation %d", op);
          abort();

Pre-existing, so:
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

But since this is a guest error, I'd prefer we exit(1) instead.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]