aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/datacache/plugin_datacache_mysql.c2
-rw-r--r--src/datastore/plugin_datastore_mysql.c2
-rw-r--r--src/fs/fs.c2
-rw-r--r--src/hello/hello.c1
-rw-r--r--src/include/gnunet_common.h11
-rw-r--r--src/util/common_allocation.c6
-rw-r--r--src/util/common_logging.c14
-rw-r--r--src/util/crypto_random.c2
-rw-r--r--src/util/scheduler.c4
9 files changed, 32 insertions, 12 deletions
diff --git a/src/datacache/plugin_datacache_mysql.c b/src/datacache/plugin_datacache_mysql.c
index cf282dbdc..9185c5ca1 100644
--- a/src/datacache/plugin_datacache_mysql.c
+++ b/src/datacache/plugin_datacache_mysql.c
@@ -100,7 +100,7 @@
100 * a failure of the command 'cmd' with the message given 100 * a failure of the command 'cmd' with the message given
101 * by strerror(errno). 101 * by strerror(errno).
102 */ 102 */
103#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); 103#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);
104 104
105/** 105/**
106 * Log an error message at log-level 'level' that indicates 106 * Log an error message at log-level 'level' that indicates
diff --git a/src/datastore/plugin_datastore_mysql.c b/src/datastore/plugin_datastore_mysql.c
index 1048a370f..a6e65eeec 100644
--- a/src/datastore/plugin_datastore_mysql.c
+++ b/src/datastore/plugin_datastore_mysql.c
@@ -136,7 +136,7 @@
136 * a failure of the command 'cmd' with the message given 136 * a failure of the command 'cmd' with the message given
137 * by strerror(errno). 137 * by strerror(errno).
138 */ 138 */
139#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); 139#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);
140 140
141/** 141/**
142 * Log an error message at log-level 'level' that indicates 142 * Log an error message at log-level 'level' that indicates
diff --git a/src/fs/fs.c b/src/fs/fs.c
index 93971075a..83c0bf271 100644
--- a/src/fs/fs.c
+++ b/src/fs/fs.c
@@ -2464,7 +2464,7 @@ deserialize_download (struct GNUNET_FS_Handle *h,
2464 } 2464 }
2465 if (parent != NULL) 2465 if (parent != NULL)
2466 { 2466 {
2467 abort (); // for debugging for now 2467 GNUNET_abort (); // for debugging for now - FIXME
2468 GNUNET_CONTAINER_DLL_insert (parent->child_head, parent->child_tail, dc); 2468 GNUNET_CONTAINER_DLL_insert (parent->child_head, parent->child_tail, dc);
2469 } 2469 }
2470 if (search != NULL) 2470 if (search != NULL)
diff --git a/src/hello/hello.c b/src/hello/hello.c
index a0c26d1ab..a95c0eee2 100644
--- a/src/hello/hello.c
+++ b/src/hello/hello.c
@@ -130,7 +130,6 @@ get_hello_address_size (const char *buf, size_t max, uint16_t * ralen)
130 { 130 {
131 /* 0-termination not found */ 131 /* 0-termination not found */
132 GNUNET_break_op (0); 132 GNUNET_break_op (0);
133 abort ();
134 return 0; 133 return 0;
135 } 134 }
136 pos++; 135 pos++;
diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h
index 8f3ff8127..69a428bb5 100644
--- a/src/include/gnunet_common.h
+++ b/src/include/gnunet_common.h
@@ -245,6 +245,13 @@ GNUNET_log_from_nocheck (enum GNUNET_ErrorType kind, const char *comp,
245#define GNUNET_log_from(...) 245#define GNUNET_log_from(...)
246#endif 246#endif
247 247
248
249/**
250 * Abort the process, generate a core dump if possible.
251 */
252void
253GNUNET_abort (void);
254
248/** 255/**
249 * Ignore the next n calls to the log function. 256 * Ignore the next n calls to the log function.
250 * 257 *
@@ -351,12 +358,12 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind);
351/** 358/**
352 * Use this for fatal errors that cannot be handled 359 * Use this for fatal errors that cannot be handled
353 */ 360 */
354#define GNUNET_assert(cond) do { if (! (cond)) { GNUNET_log(GNUNET_ERROR_TYPE_ERROR, _("Assertion failed at %s:%d.\n"), __FILE__, __LINE__); abort(); } } while(0) 361#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)
355 362
356/** 363/**
357 * Use this for fatal errors that cannot be handled 364 * Use this for fatal errors that cannot be handled
358 */ 365 */
359#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) 366#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)
360 367
361/** 368/**
362 * Use this for internal assertion violations that are 369 * Use this for internal assertion violations that are
diff --git a/src/util/common_allocation.c b/src/util/common_allocation.c
index 340ad5334..fd5e993e2 100644
--- a/src/util/common_allocation.c
+++ b/src/util/common_allocation.c
@@ -67,7 +67,7 @@ GNUNET_xmalloc_ (size_t size, const char *filename, int linenumber)
67 if (ret == NULL) 67 if (ret == NULL)
68 { 68 {
69 LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "malloc"); 69 LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "malloc");
70 abort (); 70 GNUNET_abort ();
71 } 71 }
72 return ret; 72 return ret;
73} 73}
@@ -103,7 +103,7 @@ GNUNET_xmemdup_ (const void *buf, size_t size, const char *filename,
103 if (ret == NULL) 103 if (ret == NULL)
104 { 104 {
105 LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "malloc"); 105 LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "malloc");
106 abort (); 106 GNUNET_abort ();
107 } 107 }
108#ifdef W32_MEM_LIMIT 108#ifdef W32_MEM_LIMIT
109 *((size_t *) ret) = size; 109 *((size_t *) ret) = size;
@@ -174,7 +174,7 @@ GNUNET_xrealloc_ (void *ptr, size_t n, const char *filename, int linenumber)
174 if ((NULL == ptr) && (n > 0)) 174 if ((NULL == ptr) && (n > 0))
175 { 175 {
176 LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "realloc"); 176 LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "realloc");
177 abort (); 177 GNUNET_abort ();
178 } 178 }
179#ifdef W32_MEM_LIMIT 179#ifdef W32_MEM_LIMIT
180 ptr = &((size_t *) ptr)[1]; 180 ptr = &((size_t *) ptr)[1];
diff --git a/src/util/common_logging.c b/src/util/common_logging.c
index 101f2fd9f..e96fb8e78 100644
--- a/src/util/common_logging.c
+++ b/src/util/common_logging.c
@@ -260,6 +260,20 @@ resize_logdefs ()
260 logdefs = GNUNET_realloc (logdefs, logdefs_size * sizeof (struct LogDef)); 260 logdefs = GNUNET_realloc (logdefs, logdefs_size * sizeof (struct LogDef));
261} 261}
262 262
263
264/**
265 * Abort the process, generate a core dump if possible.
266 */
267void
268GNUNET_abort ()
269{
270#if WINDOWS
271 DebugBreak();
272#endif
273 abort();
274}
275
276
263/** 277/**
264 * Utility function - adds a parsed definition to logdefs array. 278 * Utility function - adds a parsed definition to logdefs array.
265 * 279 *
diff --git a/src/util/crypto_random.c b/src/util/crypto_random.c
index c74d60f4f..719acf07c 100644
--- a/src/util/crypto_random.c
+++ b/src/util/crypto_random.c
@@ -266,7 +266,7 @@ void __attribute__ ((constructor)) GNUNET_CRYPTO_random_init ()
266 _ 266 _
267 ("libgcrypt has not the expected version (version %s is required).\n"), 267 ("libgcrypt has not the expected version (version %s is required).\n"),
268 GCRYPT_VERSION); 268 GCRYPT_VERSION);
269 abort (); 269 GNUNET_abort ();
270 } 270 }
271#ifdef gcry_fast_random_poll 271#ifdef gcry_fast_random_poll
272 gcry_fast_random_poll (); 272 gcry_fast_random_poll ();
diff --git a/src/util/scheduler.c b/src/util/scheduler.c
index 0c4374471..82b888fec 100644
--- a/src/util/scheduler.c
+++ b/src/util/scheduler.c
@@ -676,7 +676,7 @@ run_ready (struct GNUNET_NETWORK_FDSet *rs, struct GNUNET_NETWORK_FDSet *ws)
676 if (((tc.reason & GNUNET_SCHEDULER_REASON_WRITE_READY) != 0) && 676 if (((tc.reason & GNUNET_SCHEDULER_REASON_WRITE_READY) != 0) &&
677 (pos->write_fd != -1) && 677 (pos->write_fd != -1) &&
678 (!GNUNET_NETWORK_fdset_test_native (ws, pos->write_fd))) 678 (!GNUNET_NETWORK_fdset_test_native (ws, pos->write_fd)))
679 abort (); // added to ready in previous select loop! 679 GNUNET_abort (); // added to ready in previous select loop!
680#if DEBUG_TASKS 680#if DEBUG_TASKS
681 LOG (GNUNET_ERROR_TYPE_DEBUG, "Running task: %llu / %p\n", pos->id, 681 LOG (GNUNET_ERROR_TYPE_DEBUG, "Running task: %llu / %p\n", pos->id,
682 pos->callback_cls); 682 pos->callback_cls);
@@ -852,7 +852,7 @@ GNUNET_SCHEDULER_run (GNUNET_SCHEDULER_Task task, void *task_cls)
852 LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "system"); 852 LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "system");
853#endif 853#endif
854#endif 854#endif
855 abort (); 855 GNUNET_abort ();
856 break; 856 break;
857 } 857 }
858 if ((ret == 0) && (timeout.rel_value == 0) && (busy_wait_warning > 16)) 858 if ((ret == 0) && (timeout.rel_value == 0) && (busy_wait_warning > 16))