gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r18028 - in gnunet/src: datacache datastore fs hello includ


From: gnunet
Subject: [GNUnet-SVN] r18028 - in gnunet/src: datacache datastore fs hello include util
Date: Sat, 5 Nov 2011 19:47:50 +0100

Author: grothoff
Date: 2011-11-05 19:47:50 +0100 (Sat, 05 Nov 2011)
New Revision: 18028

Modified:
   gnunet/src/datacache/plugin_datacache_mysql.c
   gnunet/src/datastore/plugin_datastore_mysql.c
   gnunet/src/fs/fs.c
   gnunet/src/hello/hello.c
   gnunet/src/include/gnunet_common.h
   gnunet/src/util/common_allocation.c
   gnunet/src/util/common_logging.c
   gnunet/src/util/crypto_random.c
   gnunet/src/util/scheduler.c
Log:
introducing GNUNET_abort

Modified: gnunet/src/datacache/plugin_datacache_mysql.c
===================================================================
--- gnunet/src/datacache/plugin_datacache_mysql.c       2011-11-05 18:42:45 UTC 
(rev 18027)
+++ gnunet/src/datacache/plugin_datacache_mysql.c       2011-11-05 18:47:50 UTC 
(rev 18028)
@@ -100,7 +100,7 @@
  * a failure of the command 'cmd' with the message given
  * by strerror(errno).
  */
-#define DIE_MYSQL(cmd, dbh) do { GNUNET_log(GNUNET_ERROR_TYPE__ERROR, _("`%s' 
failed at %s:%d with error: %s\n"), cmd, __FILE__, __LINE__, 
mysql_error((dbh)->dbf)); abort(); } while(0);
+#define DIE_MYSQL(cmd, dbh) do { GNUNET_log(GNUNET_ERROR_TYPE__ERROR, _("`%s' 
failed at %s:%d with error: %s\n"), cmd, __FILE__, __LINE__, 
mysql_error((dbh)->dbf)); GNUNET_abort(); } while(0);
 
 /**
  * Log an error message at log-level 'level' that indicates

Modified: gnunet/src/datastore/plugin_datastore_mysql.c
===================================================================
--- gnunet/src/datastore/plugin_datastore_mysql.c       2011-11-05 18:42:45 UTC 
(rev 18027)
+++ gnunet/src/datastore/plugin_datastore_mysql.c       2011-11-05 18:47:50 UTC 
(rev 18028)
@@ -136,7 +136,7 @@
  * a failure of the command 'cmd' with the message given
  * by strerror(errno).
  */
-#define DIE_MYSQL(cmd, dbh) do { GNUNET_log(GNUNET_ERROR_TYPE_ERROR, _("`%s' 
failed at %s:%d with error: %s\n"), cmd, __FILE__, __LINE__, 
mysql_error((dbh)->dbf)); abort(); } while(0);
+#define DIE_MYSQL(cmd, dbh) do { GNUNET_log(GNUNET_ERROR_TYPE_ERROR, _("`%s' 
failed at %s:%d with error: %s\n"), cmd, __FILE__, __LINE__, 
mysql_error((dbh)->dbf)); GNUNET_abort(); } while(0);
 
 /**
  * Log an error message at log-level 'level' that indicates

Modified: gnunet/src/fs/fs.c
===================================================================
--- gnunet/src/fs/fs.c  2011-11-05 18:42:45 UTC (rev 18027)
+++ gnunet/src/fs/fs.c  2011-11-05 18:47:50 UTC (rev 18028)
@@ -2464,7 +2464,7 @@
   }
   if (parent != NULL)
   {
-    abort ();                   // for debugging for now
+    GNUNET_abort ();                   // for debugging for now - FIXME
     GNUNET_CONTAINER_DLL_insert (parent->child_head, parent->child_tail, dc);
   }
   if (search != NULL)

Modified: gnunet/src/hello/hello.c
===================================================================
--- gnunet/src/hello/hello.c    2011-11-05 18:42:45 UTC (rev 18027)
+++ gnunet/src/hello/hello.c    2011-11-05 18:47:50 UTC (rev 18028)
@@ -130,7 +130,6 @@
   {
     /* 0-termination not found */
     GNUNET_break_op (0);
-    abort ();
     return 0;
   }
   pos++;

Modified: gnunet/src/include/gnunet_common.h
===================================================================
--- gnunet/src/include/gnunet_common.h  2011-11-05 18:42:45 UTC (rev 18027)
+++ gnunet/src/include/gnunet_common.h  2011-11-05 18:47:50 UTC (rev 18028)
@@ -245,7 +245,14 @@
 #define GNUNET_log_from(...)
 #endif
 
+
 /**
+ * Abort the process, generate a core dump if possible.
+ */
+void
+GNUNET_abort (void);
+
+/**
  * Ignore the next n calls to the log function.
  *
  * @param n number of log calls to ignore
@@ -351,12 +358,12 @@
 /**
  * Use this for fatal errors that cannot be handled
  */
-#define GNUNET_assert(cond) do { if (! (cond)) { 
GNUNET_log(GNUNET_ERROR_TYPE_ERROR, _("Assertion failed at %s:%d.\n"), 
__FILE__, __LINE__); abort(); } } while(0)
+#define GNUNET_assert(cond) do { if (! (cond)) { 
GNUNET_log(GNUNET_ERROR_TYPE_ERROR, _("Assertion failed at %s:%d.\n"), 
__FILE__, __LINE__); GNUNET_abort(); } } while(0)
 
 /**
  * Use this for fatal errors that cannot be handled
  */
-#define GNUNET_assert_at(cond, f, l) do { if (! (cond)) { 
GNUNET_log(GNUNET_ERROR_TYPE_ERROR, _("Assertion failed at %s:%d.\n"), f, l); 
abort(); } } while(0)
+#define GNUNET_assert_at(cond, f, l) do { if (! (cond)) { 
GNUNET_log(GNUNET_ERROR_TYPE_ERROR, _("Assertion failed at %s:%d.\n"), f, l); 
GNUNET_abort(); } } while(0)
 
 /**
  * Use this for internal assertion violations that are

Modified: gnunet/src/util/common_allocation.c
===================================================================
--- gnunet/src/util/common_allocation.c 2011-11-05 18:42:45 UTC (rev 18027)
+++ gnunet/src/util/common_allocation.c 2011-11-05 18:47:50 UTC (rev 18028)
@@ -67,7 +67,7 @@
   if (ret == NULL)
   {
     LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "malloc");
-    abort ();
+    GNUNET_abort ();
   }
   return ret;
 }
@@ -103,7 +103,7 @@
   if (ret == NULL)
   {
     LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "malloc");
-    abort ();
+    GNUNET_abort ();
   }
 #ifdef W32_MEM_LIMIT
   *((size_t *) ret) = size;
@@ -174,7 +174,7 @@
   if ((NULL == ptr) && (n > 0))
   {
     LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "realloc");
-    abort ();
+    GNUNET_abort ();
   }
 #ifdef W32_MEM_LIMIT
   ptr = &((size_t *) ptr)[1];

Modified: gnunet/src/util/common_logging.c
===================================================================
--- gnunet/src/util/common_logging.c    2011-11-05 18:42:45 UTC (rev 18027)
+++ gnunet/src/util/common_logging.c    2011-11-05 18:47:50 UTC (rev 18028)
@@ -260,7 +260,21 @@
   logdefs = GNUNET_realloc (logdefs, logdefs_size * sizeof (struct LogDef));
 }
 
+
 /**
+ * Abort the process, generate a core dump if possible.
+ */
+void
+GNUNET_abort ()
+{
+#if WINDOWS
+  DebugBreak();
+#endif
+  abort();
+}
+
+
+/**
  * Utility function - adds a parsed definition to logdefs array.
  *
  * @param component see struct LogDef, can't be NULL

Modified: gnunet/src/util/crypto_random.c
===================================================================
--- gnunet/src/util/crypto_random.c     2011-11-05 18:42:45 UTC (rev 18027)
+++ gnunet/src/util/crypto_random.c     2011-11-05 18:47:50 UTC (rev 18028)
@@ -266,7 +266,7 @@
              _
              ("libgcrypt has not the expected version (version %s is 
required).\n"),
              GCRYPT_VERSION);
-    abort ();
+    GNUNET_abort ();
   }
 #ifdef gcry_fast_random_poll
   gcry_fast_random_poll ();

Modified: gnunet/src/util/scheduler.c
===================================================================
--- gnunet/src/util/scheduler.c 2011-11-05 18:42:45 UTC (rev 18027)
+++ gnunet/src/util/scheduler.c 2011-11-05 18:47:50 UTC (rev 18028)
@@ -676,7 +676,7 @@
     if (((tc.reason & GNUNET_SCHEDULER_REASON_WRITE_READY) != 0) &&
         (pos->write_fd != -1) &&
         (!GNUNET_NETWORK_fdset_test_native (ws, pos->write_fd)))
-      abort ();                 // added to ready in previous select loop!
+      GNUNET_abort ();                 // added to ready in previous select 
loop!
 #if DEBUG_TASKS
     LOG (GNUNET_ERROR_TYPE_DEBUG, "Running task: %llu / %p\n", pos->id,
          pos->callback_cls);
@@ -852,7 +852,7 @@
         LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "system");
 #endif
 #endif
-      abort ();
+      GNUNET_abort ();
       break;
     }
     if ((ret == 0) && (timeout.rel_value == 0) && (busy_wait_warning > 16))




reply via email to

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