aboutsummaryrefslogtreecommitdiff
path: root/src/testbed/gnunet-cmds-helper.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testbed/gnunet-cmds-helper.c')
-rw-r--r--src/testbed/gnunet-cmds-helper.c62
1 files changed, 2 insertions, 60 deletions
diff --git a/src/testbed/gnunet-cmds-helper.c b/src/testbed/gnunet-cmds-helper.c
index 41d6c06b8..0d618bd48 100644
--- a/src/testbed/gnunet-cmds-helper.c
+++ b/src/testbed/gnunet-cmds-helper.c
@@ -44,7 +44,7 @@
44#include "testbed_api.h" 44#include "testbed_api.h"
45#include "gnunet_testing_plugin.h" 45#include "gnunet_testing_plugin.h"
46#include <zlib.h> 46#include <zlib.h>
47#include "execinfo.h" 47
48 48
49/** 49/**
50 * Generic logging shortcut 50 * Generic logging shortcut
@@ -60,8 +60,6 @@
60 60
61#define ROUTER_BASE_IP "92.68.150." 61#define ROUTER_BASE_IP "92.68.150."
62 62
63#define MAX_TRACE_DEPTH 50
64
65/** 63/**
66 * Handle for a plugin. 64 * Handle for a plugin.
67 */ 65 */
@@ -180,61 +178,6 @@ static int done_reading;
180static int status; 178static int status;
181 179
182 180
183struct BacktraceInfo
184{
185 /**
186 * Array of strings which make up a backtrace from the point when this
187 * task was scheduled (essentially, who scheduled the task?)
188 */
189 char **backtrace_strings;
190
191 /**
192 * Size of the backtrace_strings array
193 */
194 int num_backtrace_strings;
195};
196
197/**
198 * Output stack trace of task @a t.
199 *
200 * @param t task to dump stack trace of
201 */
202static void
203dump_backtrace (struct BacktraceInfo *t)
204{
205
206 for (unsigned int i = 0; i < t->num_backtrace_strings; i++)
207 LOG (GNUNET_ERROR_TYPE_ERROR,
208 "Task %p trace %u: %s\n",
209 t,
210 i,
211 t->backtrace_strings[i]);
212
213}
214
215
216/**
217 * Initialize backtrace data for task @a t
218 *
219 * @param t task to initialize
220 */
221static void
222init_backtrace ()
223{
224 struct BacktraceInfo *t;
225 void *backtrace_array[MAX_TRACE_DEPTH];
226
227 t = GNUNET_new (struct BacktraceInfo);
228 t->num_backtrace_strings
229 = backtrace (backtrace_array, MAX_TRACE_DEPTH);
230 t->backtrace_strings =
231 backtrace_symbols (backtrace_array,
232 t->num_backtrace_strings);
233 dump_backtrace (t);
234
235}
236
237
238/** 181/**
239 * Task to shut down cleanly 182 * Task to shut down cleanly
240 * 183 *
@@ -244,7 +187,6 @@ static void
244shutdown_task (void *cls) 187shutdown_task (void *cls)
245{ 188{
246 189
247 init_backtrace ();
248 LOG_DEBUG ("Shutting down.\n"); 190 LOG_DEBUG ("Shutting down.\n");
249 LOG (GNUNET_ERROR_TYPE_ERROR, 191 LOG (GNUNET_ERROR_TYPE_ERROR,
250 "Shutting down tokenizer!\n"); 192 "Shutting down tokenizer!\n");
@@ -549,7 +491,7 @@ tokenizer_cb (void *cls, const struct GNUNET_MessageHeader *message)
549 } 491 }
550 492
551 493
552error: 494 error:
553 status = GNUNET_SYSERR; 495 status = GNUNET_SYSERR;
554 LOG (GNUNET_ERROR_TYPE_ERROR, 496 LOG (GNUNET_ERROR_TYPE_ERROR,
555 "tokenizer shutting down!\n"); 497 "tokenizer shutting down!\n");