mirror of
https://github.com/weechat/weechat.git
synced 2026-07-03 00:03:12 +02:00
core: add option "libs" for command /debug, add signal "debug_libs"
This commit is contained in:
@@ -1410,6 +1410,12 @@ COMMAND_CALLBACK(debug)
|
||||
{
|
||||
debug_infolists ();
|
||||
}
|
||||
else if (string_strcasecmp (argv[1], "libs") == 0)
|
||||
{
|
||||
gui_chat_printf (NULL, "");
|
||||
gui_chat_printf (NULL, "Libs:");
|
||||
hook_signal_send ("debug_libs", WEECHAT_HOOK_SIGNAL_STRING, NULL);
|
||||
}
|
||||
else if (string_strcasecmp (argv[1], "memory") == 0)
|
||||
{
|
||||
debug_memory ();
|
||||
@@ -6359,6 +6365,7 @@ command_init ()
|
||||
"all hdata in memory)\n"
|
||||
" hooks: display infos about hooks\n"
|
||||
"infolists: display infos about infolists\n"
|
||||
" libs: display infos about external libraries used\n"
|
||||
" memory: display infos about memory usage\n"
|
||||
" mouse: toggle debug for mouse\n"
|
||||
" tags: display tags for lines\n"
|
||||
@@ -6374,6 +6381,7 @@ command_init ()
|
||||
" || hdata free"
|
||||
" || hooks"
|
||||
" || infolists"
|
||||
" || libs"
|
||||
" || memory"
|
||||
" || mouse verbose"
|
||||
" || tags"
|
||||
|
||||
+50
-1
@@ -29,6 +29,13 @@
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <gcrypt.h>
|
||||
#include <curl/curl.h>
|
||||
#include <zlib.h>
|
||||
|
||||
#ifdef HAVE_GNUTLS
|
||||
#include <gnutls/gnutls.h>
|
||||
#endif
|
||||
|
||||
#include "weechat.h"
|
||||
#include "wee-backtrace.h"
|
||||
@@ -496,6 +503,42 @@ debug_infolists ()
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Callback for signal "debug_libs": displays infos about external libraries
|
||||
* used (called when command "/debug libs" is issued).
|
||||
*
|
||||
* Note: this function displays libraries for WeeChat core only: plugins can
|
||||
* catch this signal to display their external libraries.
|
||||
*/
|
||||
|
||||
int
|
||||
debug_libs_cb (void *data, const char *signal, const char *type_data,
|
||||
void *signal_data)
|
||||
{
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
(void) signal;
|
||||
(void) type_data;
|
||||
(void) signal_data;
|
||||
|
||||
gui_chat_printf (NULL, " core:");
|
||||
gui_main_debug_libs ();
|
||||
gui_chat_printf (NULL, " gcrypt: v%s%s",
|
||||
GCRYPT_VERSION,
|
||||
(weechat_no_gcrypt) ? " (not initialized)" : "");
|
||||
#ifdef HAVE_GNUTLS
|
||||
gui_chat_printf (NULL, " gnutls: v%s%s",
|
||||
GNUTLS_VERSION,
|
||||
(weechat_no_gnutls) ? " (not initialized)" : "");
|
||||
#else
|
||||
gui_chat_printf (NULL, " gnutls: (not available)");
|
||||
#endif
|
||||
gui_chat_printf (NULL, " curl: v%s", LIBCURL_VERSION);
|
||||
gui_chat_printf (NULL, " zlib: v%s", ZLIB_VERSION);
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Displays WeeChat directories.
|
||||
*/
|
||||
@@ -519,5 +562,11 @@ debug_directories ()
|
||||
void
|
||||
debug_init ()
|
||||
{
|
||||
hook_signal (NULL, "debug_dump", &debug_dump_cb, NULL);
|
||||
/*
|
||||
* hook signals with high priority, to be sure they will be used before
|
||||
* plugins (they should anyway because this function is called before load
|
||||
* of plugins)
|
||||
*/
|
||||
hook_signal (NULL, "2000|debug_dump", &debug_dump_cb, NULL);
|
||||
hook_signal (NULL, "2000|debug_libs", &debug_libs_cb, NULL);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user