[pypy-commit] pypy stmgc-c8: Fix debugging code: it was passing a "TLPREFIX char *" to fprintf

arigo noreply at buildbot.pypy.org
Mon Mar 2 18:25:44 CET 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: stmgc-c8
Changeset: r76221:8b4db8387697
Date: 2015-03-02 18:25 +0100
http://bitbucket.org/pypy/pypy/changeset/8b4db8387697/

Log:	Fix debugging code: it was passing a "TLPREFIX char *" to fprintf

diff --git a/rpython/translator/c/src/debug_traceback.c b/rpython/translator/c/src/debug_traceback.c
--- a/rpython/translator/c/src/debug_traceback.c
+++ b/rpython/translator/c/src/debug_traceback.c
@@ -65,9 +65,24 @@
 
 void pypy_debug_catch_fatal_exception(void)
 {
-  pypy_debug_traceback_print();
-  fprintf(stderr, "Fatal RPython error: %.*s\n",
-          (int)(RPyFetchExceptionType()->ov_name->rs_chars.length),
-          RPyFetchExceptionType()->ov_name->rs_chars.items);
-  abort();
+    const char *clsname;
+    pypy_debug_traceback_print();
+    fprintf(stderr, "Fatal RPython error: ");
+#ifdef RPY_STM
+    char bufname[128];
+    int i;
+    bufname[127] = 0;
+    for (i = 0; i < 127; i++) {
+        bufname[i] = RPyFetchExceptionType()->ov_name->rs_chars.items[i];
+        if (bufname[i] == 0)
+            break;
+    }
+    clsname = bufname;
+#else
+    clsname = RPyFetchExceptionType()->ov_name->rs_chars.items;
+#endif
+    fprintf(stderr, "%.*s\n",
+            (int)(RPyFetchExceptionType()->ov_name->rs_chars.length),
+            clsname);
+    abort();
 }


More information about the pypy-commit mailing list