From 652b2d0c4305bbff41c456f31ee465f1103ec5f8 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Mon, 15 Aug 2011 16:16:36 -0700 Subject: [PATCH] plugin: Add debug support for external plugins --- include/plugin.h | 10 +++++++++- src/plugin.c | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/include/plugin.h b/include/plugin.h index 6f580424..ca273beb 100644 --- a/include/plugin.h +++ b/include/plugin.h @@ -23,6 +23,7 @@ #define __OFONO_PLUGIN_H #include +#include #ifdef __cplusplus extern "C" { @@ -50,6 +51,8 @@ struct ofono_plugin_desc { int priority; int (*init) (void); void (*exit) (void); + void *debug_start; + void *debug_stop; }; /** @@ -69,10 +72,15 @@ struct ofono_plugin_desc { }; #else #define OFONO_PLUGIN_DEFINE(name, description, version, priority, init, exit) \ + extern struct ofono_debug_desc __start___debug[] \ + __attribute__ ((visibility("hidden"))); \ + extern struct ofono_debug_desc __stop___debug[] \ + __attribute__ ((visibility("hidden"))); \ extern struct ofono_plugin_desc ofono_plugin_desc \ __attribute__ ((visibility("default"))); \ struct ofono_plugin_desc ofono_plugin_desc = { \ - #name, description, version, priority, init, exit \ + #name, description, version, priority, init, exit, \ + __start___debug, __stop___debug \ }; #endif diff --git a/src/plugin.c b/src/plugin.c index d4841856..ccfedb1b 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -66,6 +66,8 @@ static gboolean add_plugin(void *handle, struct ofono_plugin_desc *desc) plugin->active = FALSE; plugin->desc = desc; + __ofono_log_enable(desc->debug_start, desc->debug_stop); + plugins = g_slist_insert_sorted(plugins, plugin, compare_priority); return TRUE;