From: Chris Larson Date: Sat, 1 Nov 2008 20:45:57 +0000 (+0000) Subject: Add debug prints to plugin loading X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=529147539a7a81538f07ce8df8a37e22a629669f;p=android-x86%2Fexternal-tslib.git Add debug prints to plugin loading Add some debug prints (and include stdio.h) which can help diagnose plugin load problems. Signed-off-by: Ville Syrjala Signed-off-by: Chris Larson --- diff --git a/src/ts_load_module.c b/src/ts_load_module.c index 266740e..9605b5c 100644 --- a/src/ts_load_module.c +++ b/src/ts_load_module.c @@ -15,6 +15,7 @@ #ifdef HAVE_ALLOCA_H #include #endif +#include #include #include #include @@ -46,17 +47,27 @@ int __ts_load_module(struct tsdev *ts, const char *module, const char *params, i printf ("Loading module %s\n", fn); #endif handle = dlopen(fn, RTLD_NOW); - if (!handle) + if (!handle) { +#ifdef DEBUG + fprintf (stderr, "%s dlopen() failed: %s\n", fn, dlerror()); +#endif return -1; + } init = dlsym(handle, "mod_init"); if (!init) { +#ifdef DEBUG + fprintf (stderr, "%s dlsym() failed: %s\n", fn, dlerror()); +#endif dlclose(handle); return -1; } info = init(ts, params); if (!info) { +#ifdef DEBUG + fprintf (stderr, "Can't init %s\n", fn); +#endif dlclose(handle); return -1; } @@ -69,6 +80,9 @@ int __ts_load_module(struct tsdev *ts, const char *module, const char *params, i ret = __ts_attach(ts, info); } if (ret) { +#ifdef DEBUG + fprintf (stderr, "Can't attach %s\n", fn); +#endif info->ops->fini(info); dlclose(handle); }