mirror of
https://github.com/weechat/weechat.git
synced 2026-06-29 22:36:38 +02:00
Add hidden command line option --no-dlclose to remove dlclose() for unloaded plugins (useful when using valgrind)
This commit is contained in:
@@ -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))
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user