[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pypy-svn
Subject:    [pypy-commit] stmgc default: Add stm_dump_dbg(), maybe useful for debugging with gdb
From:       arigo <noreply () buildbot ! pypy ! org>
Date:       2013-08-31 12:42:26
Message-ID: 20130831124226.F25E51C00D8 () cobra ! cs ! uni-duesseldorf ! de
[Download RAW message or body]

Author: Armin Rigo <arigo@tunes.org>
Branch: 
Changeset: r505:a3d84b625ddb
Date: 2013-08-31 13:42 +0100
http://bitbucket.org/pypy/stmgc/changeset/a3d84b625ddb/

Log:	Add stm_dump_dbg(), maybe useful for debugging with gdb

diff --git a/c4/et.c b/c4/et.c
--- a/c4/et.c
+++ b/c4/et.c
@@ -26,6 +26,31 @@
     return tmp_buf;
 }
 
+void stm_dump_dbg(void)
+{
+    fprintf(stderr, "/**** stm_dump_dbg ****/\n\n");
+
+    int i;
+    for (i = 0; i < MAX_THREADS; i++) {
+        struct tx_public_descriptor *pd = stm_descriptor_array[i];
+        if (pd == NULL)
+            continue;
+        fprintf(stderr, "stm_descriptor_array[%d]\npublic_descriptor: %p\n",
+                i, pd);
+
+        struct tx_descriptor *d = stm_tx_head;
+        while (d && d->public_descriptor != pd)
+            d = d->tx_next;
+        if (!d)
+            continue;
+
+        fprintf(stderr, "thread_descriptor: \033[%dm%p\033[0m\n\n",
+                d->tcolor, d);
+    }
+
+    fprintf(stderr, "/**********************/\n");
+}
+
 
 
 __thread struct tx_descriptor *thread_descriptor = NULL;
@@ -1673,6 +1698,7 @@
       stm_thread_local_obj = NULL;
       d->thread_local_obj_ref = &stm_thread_local_obj;
       d->max_aborts = -1;
+      d->tcolor = dprintfcolor();
       d->tx_prev = NULL;
       d->tx_next = stm_tx_head;
       if (d->tx_next != NULL) d->tx_next->tx_prev = d;
diff --git a/c4/et.h b/c4/et.h
--- a/c4/et.h
+++ b/c4/et.h
@@ -175,6 +175,7 @@
   struct FXCache recent_reads_cache;
   char **read_barrier_cache_ref;
   struct tx_descriptor *tx_prev, *tx_next;
+  int tcolor;
 };
 
 extern __thread struct tx_descriptor *thread_descriptor;
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic