diff options
author | Nathan S. Evans <evans@in.tum.de> | 2010-06-24 11:23:46 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2010-06-24 11:23:46 +0000 |
commit | 6962c57d641bc3e799ce57dda16c39aa865f33d6 (patch) | |
tree | 3bc8f7317150f652f96b63a8e6e5cd3ce42554f0 /src | |
parent | f587381bc6a8bfa4194436c89e0ec8822426ccbc (diff) | |
download | gnunet-6962c57d641bc3e799ce57dda16c39aa865f33d6.tar.gz gnunet-6962c57d641bc3e799ce57dda16c39aa865f33d6.zip |
fix execinfo debugging so it doesn't deref NULL pointer, still not entirely useful for the common person
Diffstat (limited to 'src')
-rw-r--r-- | src/util/scheduler.c | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/src/util/scheduler.c b/src/util/scheduler.c index 8e8fe392c..b94152025 100644 --- a/src/util/scheduler.c +++ b/src/util/scheduler.c | |||
@@ -34,7 +34,7 @@ | |||
34 | 34 | ||
35 | /** | 35 | /** |
36 | * Use lsof to generate file descriptor reports on select error? | 36 | * Use lsof to generate file descriptor reports on select error? |
37 | * (turn of for stable releases). | 37 | * (turn off for stable releases). |
38 | */ | 38 | */ |
39 | #define USE_LSOF GNUNET_YES | 39 | #define USE_LSOF GNUNET_YES |
40 | 40 | ||
@@ -548,26 +548,26 @@ run_ready (struct GNUNET_SCHEDULER_Handle *sched) | |||
548 | "Task %u took %llums to be scheduled\n", | 548 | "Task %u took %llums to be scheduled\n", |
549 | pos->id, | 549 | pos->id, |
550 | (unsigned long long) GNUNET_TIME_absolute_get_duration (pos->start_time).value); | 550 | (unsigned long long) GNUNET_TIME_absolute_get_duration (pos->start_time).value); |
551 | #if EXECINFO | ||
552 | int i; | ||
553 | for (i=0;i<pos->num_backtrace_strings;i++) | ||
554 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
555 | "Task %u trace %d: %s\n", | ||
556 | pos->id, | ||
557 | i, | ||
558 | pos->backtrace_strings[i]); | ||
559 | #endif | ||
560 | } | 551 | } |
561 | #endif | 552 | #endif |
562 | tc.sched = sched; | 553 | tc.sched = sched; |
563 | tc.reason = pos->reason; | 554 | tc.reason = pos->reason; |
564 | tc.read_ready = pos->read_set; | 555 | tc.read_ready = pos->read_set; |
565 | tc.write_ready = pos->write_set; | 556 | tc.write_ready = pos->write_set; |
566 | pos->callback (pos->callback_cls, &tc); | ||
567 | #if DEBUG_TASKS | 557 | #if DEBUG_TASKS |
568 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 558 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
569 | "Running task: %llu / %p\n", pos->id, pos->callback_cls); | 559 | "Running task: %llu / %p\n", pos->id, pos->callback_cls); |
570 | #endif | 560 | #endif |
561 | pos->callback (pos->callback_cls, &tc); | ||
562 | #if EXECINFO | ||
563 | int i; | ||
564 | for (i=0;i<pos->num_backtrace_strings;i++) | ||
565 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
566 | "Task %u trace %d: %s\n", | ||
567 | pos->id, | ||
568 | i, | ||
569 | pos->backtrace_strings[i]); | ||
570 | #endif | ||
571 | sched->active_task = NULL; | 571 | sched->active_task = NULL; |
572 | destroy_task (pos); | 572 | destroy_task (pos); |
573 | sched->tasks_run++; | 573 | sched->tasks_run++; |
@@ -664,6 +664,7 @@ GNUNET_SCHEDULER_run (GNUNET_SCHEDULER_Task task, void *task_cls) | |||
664 | { | 664 | { |
665 | if (errno == EINTR) | 665 | if (errno == EINTR) |
666 | continue; | 666 | continue; |
667 | |||
667 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "select"); | 668 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "select"); |
668 | #ifndef MINGW | 669 | #ifndef MINGW |
669 | #if USE_LSOF | 670 | #if USE_LSOF |
@@ -778,7 +779,9 @@ GNUNET_SCHEDULER_cancel (struct GNUNET_SCHEDULER_Handle *sched, | |||
778 | struct Task *prev; | 779 | struct Task *prev; |
779 | enum GNUNET_SCHEDULER_Priority p; | 780 | enum GNUNET_SCHEDULER_Priority p; |
780 | void *ret; | 781 | void *ret; |
781 | 782 | #if EXECINFO | |
783 | int i; | ||
784 | #endif | ||
782 | prev = NULL; | 785 | prev = NULL; |
783 | t = sched->pending; | 786 | t = sched->pending; |
784 | while (t != NULL) | 787 | while (t != NULL) |
@@ -1208,6 +1211,16 @@ GNUNET_SCHEDULER_add_select (struct GNUNET_SCHEDULER_Handle * sched, | |||
1208 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1211 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1209 | "Adding task: %llu / %p\n", t->id, t->callback_cls); | 1212 | "Adding task: %llu / %p\n", t->id, t->callback_cls); |
1210 | #endif | 1213 | #endif |
1214 | #if EXECINFO | ||
1215 | int i; | ||
1216 | |||
1217 | for (i=0;i<t->num_backtrace_strings;i++) | ||
1218 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1219 | "Task %u trace %d: %s\n", | ||
1220 | t->id, | ||
1221 | i, | ||
1222 | t->backtrace_strings[i]); | ||
1223 | #endif | ||
1211 | return t->id; | 1224 | return t->id; |
1212 | } | 1225 | } |
1213 | 1226 | ||