summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/weechat.c11
-rw-r--r--src/core/weechat.h1
-rw-r--r--src/plugins/plugin.c3
3 files changed, 14 insertions, 1 deletions
diff --git a/src/core/weechat.c b/src/core/weechat.c
index a1fad5d70..d02e18012 100644
--- a/src/core/weechat.c
+++ b/src/core/weechat.c
@@ -79,6 +79,8 @@ char *weechat_home = NULL; /* home dir. (default: ~/.weechat) */
char *weechat_local_charset = NULL; /* example: ISO-8859-1, UTF-8 */
int weechat_server_cmd_line = 0; /* at least 1 server on cmd line */
int weechat_auto_load_plugins = 1; /* auto load plugins */
+int weechat_plugin_no_dlclose = 0; /* remove calls to dlclose for libs */
+ /* (useful when using valgrind) */
/*
@@ -158,6 +160,7 @@ weechat_parse_args (int argc, char *argv[])
weechat_home = NULL;
weechat_server_cmd_line = 0;
weechat_auto_load_plugins = 1;
+ weechat_plugin_no_dlclose = 0;
for (i = 1; i < argc; i++)
{
@@ -193,6 +196,14 @@ weechat_parse_args (int argc, char *argv[])
string_iconv_fprintf (stdout, "\n%s%s", WEECHAT_LICENSE);
weechat_shutdown (EXIT_SUCCESS, 0);
}
+ else if (strcmp (argv[i], "--no-dlclose") == 0)
+ {
+ /* tools like valgrind work better when dlclose() is not done
+ after plugins are unloaded, they can display stack for plugins,
+ otherwise you'll see "???" in stack for functions of unloaded
+ plugins -- this option should not be used for other purposes! */
+ weechat_plugin_no_dlclose = 1;
+ }
else if ((strcmp (argv[i], "-p") == 0)
|| (strcmp (argv[i], "--no-plugin") == 0))
{
diff --git a/src/core/weechat.h b/src/core/weechat.h
index 493e278de..8801eacc5 100644
--- a/src/core/weechat.h
+++ b/src/core/weechat.h
@@ -105,6 +105,7 @@ extern time_t weechat_start_time;
extern int weechat_quit;
extern char *weechat_home;
extern char *weechat_local_charset;
+extern int weechat_plugin_no_dlclose;
extern void weechat_shutdown (int return_code, int crash);
diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c
index 636734722..e7538beb2 100644
--- a/src/plugins/plugin.c
+++ b/src/plugins/plugin.c
@@ -745,7 +745,8 @@ plugin_remove (struct t_weechat_plugin *plugin)
/* free data */
if (plugin->filename)
free (plugin->filename);
- dlclose (plugin->handle);
+ if (!weechat_plugin_no_dlclose)
+ dlclose (plugin->handle);
if (plugin->name)
free (plugin->name);
if (plugin->description)