mirror of
https://github.com/weechat/weechat.git
synced 2026-07-02 15:53:12 +02:00
Added new plugin "debug"
This commit is contained in:
@@ -16,9 +16,9 @@
|
||||
|
||||
SET(LIB_CORE_SRC weechat.c weechat.h wee-backtrace.c wee-backtrace.h
|
||||
wee-command.c wee-command.h wee-config.c wee-config.h wee-config-file.c
|
||||
wee-config-file.h wee-hook.c wee-hook.h wee-input.c wee-input.h wee-list.c
|
||||
wee-list.h wee-log.c wee-log.h wee-string.c wee-string.h wee-upgrade.c
|
||||
wee-upgrade.h wee-utf8.c wee-utf8.h wee-util.c wee-util.h)
|
||||
wee-config-file.h wee-debug.c wee-debug.h wee-hook.c wee-hook.h wee-input.c
|
||||
wee-input.h wee-list.c wee-list.h wee-log.c wee-log.h wee-string.c wee-string.h
|
||||
wee-upgrade.c wee-upgrade.h wee-utf8.c wee-utf8.h wee-util.c wee-util.h)
|
||||
|
||||
# Check for flock support
|
||||
INCLUDE(CheckSymbolExists)
|
||||
|
||||
@@ -28,6 +28,8 @@ lib_weechat_core_a_SOURCES = weechat.c \
|
||||
wee-config.h \
|
||||
wee-config-file.c \
|
||||
wee-config-file.h \
|
||||
wee-debug.c \
|
||||
wee-debug.h \
|
||||
wee-hook.c \
|
||||
wee-hook.h \
|
||||
wee-input.c \
|
||||
|
||||
+21
-117
@@ -32,6 +32,7 @@
|
||||
#include "wee-command.h"
|
||||
#include "wee-config.h"
|
||||
#include "wee-config-file.h"
|
||||
#include "wee-debug.h"
|
||||
#include "wee-hook.h"
|
||||
#include "wee-input.h"
|
||||
#include "wee-log.h"
|
||||
@@ -375,97 +376,6 @@ command_builtin (void *data, struct t_gui_buffer *buffer,
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* command_debug_display_windows: display tree of windows
|
||||
*/
|
||||
|
||||
void
|
||||
command_debug_display_windows (struct t_gui_window_tree *tree, int indent)
|
||||
{
|
||||
char format[128];
|
||||
|
||||
if (tree)
|
||||
{
|
||||
if (tree->window)
|
||||
{
|
||||
/* leaf */
|
||||
snprintf (format,
|
||||
sizeof (format),
|
||||
"%%-%dsleaf: 0x%%X (parent:0x%%X), win=0x%%X, "
|
||||
"child1=0x%%X, child2=0x%%X, %%d,%%d %%dx%%d, "
|
||||
"%%d%%%%x%%d%%%%",
|
||||
indent * 2);
|
||||
gui_chat_printf (NULL,
|
||||
format,
|
||||
" ", tree, tree->parent_node, tree->window,
|
||||
tree->child1, tree->child2,
|
||||
tree->window->win_x, tree->window->win_y,
|
||||
tree->window->win_width, tree->window->win_height,
|
||||
tree->window->win_width_pct,
|
||||
tree->window->win_height_pct);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* node */
|
||||
snprintf (format,
|
||||
sizeof (format),
|
||||
"%%-%dsnode: 0x%%X (parent:0x%%X), win=0x%%X, "
|
||||
"child1=0x%%X, child2=0x%%X)",
|
||||
indent * 2);
|
||||
gui_chat_printf (NULL,
|
||||
format,
|
||||
" ", tree, tree->parent_node, tree->window,
|
||||
tree->child1, tree->child2);
|
||||
}
|
||||
|
||||
if (tree->child1)
|
||||
command_debug_display_windows (tree->child1, indent + 1);
|
||||
if (tree->child2)
|
||||
command_debug_display_windows (tree->child2, indent + 1);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* command_debug: print debug messages
|
||||
*/
|
||||
|
||||
int
|
||||
command_debug (void *data, struct t_gui_buffer *buffer,
|
||||
int argc, char **argv, char **argv_eol)
|
||||
{
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
(void) argv_eol;
|
||||
|
||||
if (argc >= 2)
|
||||
{
|
||||
if (string_strcasecmp (argv[1], "dump") == 0)
|
||||
{
|
||||
weechat_dump (0);
|
||||
}
|
||||
else if (string_strcasecmp (argv[1], "buffer") == 0)
|
||||
{
|
||||
gui_buffer_dump_hexa (buffer);
|
||||
gui_chat_printf (NULL,
|
||||
"DEBUG: buffer content written in WeeChat "
|
||||
"log file");
|
||||
}
|
||||
else if (string_strcasecmp (argv[1], "windows") == 0)
|
||||
{
|
||||
gui_chat_printf (NULL, "");
|
||||
gui_chat_printf (NULL, "DEBUG: windows tree:");
|
||||
command_debug_display_windows (gui_windows_tree, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
hook_signal_send ("debug",
|
||||
WEECHAT_HOOK_SIGNAL_STRING, argv_eol[1]);
|
||||
}
|
||||
}
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* command_help: display help about commands
|
||||
*/
|
||||
@@ -1995,7 +1905,7 @@ command_init ()
|
||||
" scroll 20 msgs up: /buffer scroll -20\n"
|
||||
" jump to #weechat: /buffer #weechat"),
|
||||
"clear|move|close|list|notify|scroll|set|%b|%c %b|%c",
|
||||
command_buffer, NULL);
|
||||
&command_buffer, NULL);
|
||||
hook_command (NULL, "builtin",
|
||||
N_("launch WeeChat builtin command (do not look at commands "
|
||||
"hooked)"),
|
||||
@@ -2003,32 +1913,20 @@ command_init ()
|
||||
N_("command: command to execute (a '/' is automatically "
|
||||
"added if not found at beginning of command)"),
|
||||
"%w",
|
||||
command_builtin, NULL);
|
||||
hook_command (NULL, "debug",
|
||||
N_("print debug messages"),
|
||||
N_("dump | buffer | windows | text"),
|
||||
N_(" dump: save memory dump in WeeChat log file (same "
|
||||
"dump is written when WeeChat crashes)\n"
|
||||
" buffer: dump buffer content with hexadecimal values "
|
||||
"in log file\n"
|
||||
"windows: display windows tree\n"
|
||||
" text: send \"debug\" signal with \"text\" as "
|
||||
"argument"),
|
||||
"dump|buffer|windows",
|
||||
command_debug, NULL);
|
||||
&command_builtin, NULL);
|
||||
hook_command (NULL, "help",
|
||||
N_("display help about commands"),
|
||||
N_("[command]"),
|
||||
N_("command: name of a WeeChat or IRC command"),
|
||||
"%w|%h",
|
||||
command_help, NULL);
|
||||
&command_help, NULL);
|
||||
hook_command (NULL, "history",
|
||||
N_("show buffer command history"),
|
||||
N_("[clear | value]"),
|
||||
N_("clear: clear history\n"
|
||||
"value: number of history entries to show"),
|
||||
"-clear",
|
||||
command_history, NULL);
|
||||
&command_history, NULL);
|
||||
hook_command (NULL, "key",
|
||||
N_("bind/unbind keys"),
|
||||
N_("[key [function/command]] [unbind key] [functions] "
|
||||
@@ -2042,7 +1940,7 @@ command_init ()
|
||||
" reset: restore bindings to the default values and "
|
||||
"delete ALL personal bindings (use carefully!)"),
|
||||
"unbind|functions|call|reset %k",
|
||||
command_key, NULL);
|
||||
&command_key, NULL);
|
||||
hook_command (NULL, "plugin",
|
||||
N_("list/load/unload plugins"),
|
||||
N_("[list [name]] | [listfull [name]] | [load filename] | "
|
||||
@@ -2057,12 +1955,12 @@ command_init ()
|
||||
" unload: unload one or all plugins\n\n"
|
||||
"Without argument, /plugin command lists loaded plugins."),
|
||||
"list|listfull|load|autoload|reload|unload %f|%p",
|
||||
command_plugin, NULL);
|
||||
&command_plugin, NULL);
|
||||
hook_command (NULL, "quit",
|
||||
N_("quit WeeChat"),
|
||||
"", "",
|
||||
"%q",
|
||||
command_quit, NULL);
|
||||
&command_quit, NULL);
|
||||
hook_command (NULL, "reload",
|
||||
N_("reload configuration files from disk"),
|
||||
N_("[file [file...]]"),
|
||||
@@ -2070,7 +1968,7 @@ command_init ()
|
||||
"Without argument, all files (WeeChat and plugins) are "
|
||||
"reloaded."),
|
||||
"%C|%*",
|
||||
command_reload, NULL);
|
||||
&command_reload, NULL);
|
||||
hook_command (NULL, "save",
|
||||
N_("save configuration files to disk"),
|
||||
N_("[file [file...]]"),
|
||||
@@ -2078,7 +1976,7 @@ command_init ()
|
||||
"Without argument, all files (WeeChat and plugins) are "
|
||||
"saved."),
|
||||
"%C|%*",
|
||||
command_save, NULL);
|
||||
&command_save, NULL);
|
||||
hook_command (NULL, "set",
|
||||
N_("set config options"),
|
||||
N_("[option [ = value]]"),
|
||||
@@ -2090,7 +1988,7 @@ command_init ()
|
||||
"\"servername\" is an internal server name and \"xxx\" "
|
||||
"an option for this server."),
|
||||
"%o = %v",
|
||||
command_set, NULL);
|
||||
&command_set, NULL);
|
||||
hook_command (NULL, "setp",
|
||||
N_("set plugin config options"),
|
||||
N_("[option [ = value]]"),
|
||||
@@ -2099,7 +1997,7 @@ command_init ()
|
||||
"Option is format: plugin.option, example: "
|
||||
"perl.myscript.item1"),
|
||||
"%O = %V",
|
||||
command_setp, NULL);
|
||||
&command_setp, NULL);
|
||||
hook_command (NULL, "upgrade",
|
||||
N_("upgrade WeeChat without disconnecting from servers"),
|
||||
N_("[path_to_binary]"),
|
||||
@@ -2109,13 +2007,13 @@ command_init ()
|
||||
"have been compiled or installed with a package manager "
|
||||
"before running this command."),
|
||||
"%f",
|
||||
command_upgrade, NULL);
|
||||
&command_upgrade, NULL);
|
||||
hook_command (NULL, "uptime",
|
||||
N_("show WeeChat uptime"),
|
||||
N_("[-o]"),
|
||||
N_("-o: send uptime on current channel as an IRC message"),
|
||||
"-o",
|
||||
command_uptime, NULL);
|
||||
&command_uptime, NULL);
|
||||
hook_command (NULL, "window",
|
||||
N_("manage windows"),
|
||||
N_("[list | -1 | +1 | b# | up | down | left | right | "
|
||||
@@ -2141,7 +2039,7 @@ command_init ()
|
||||
"window as size reference. For example 25 means create a "
|
||||
"new window with size = current_size / 4"),
|
||||
"list|-1|+1|up|down|left|right|splith|splitv|resize|merge all",
|
||||
command_window, NULL);
|
||||
&command_window, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2165,16 +2063,22 @@ command_print_stdout ()
|
||||
HOOK_COMMAND(ptr_hook, command));
|
||||
if (HOOK_COMMAND(ptr_hook, args)
|
||||
&& HOOK_COMMAND(ptr_hook, args)[0])
|
||||
{
|
||||
string_iconv_fprintf (stdout, " %s\n\n",
|
||||
_(HOOK_COMMAND(ptr_hook, args)));
|
||||
}
|
||||
else
|
||||
{
|
||||
string_iconv_fprintf (stdout, "\n\n");
|
||||
}
|
||||
string_iconv_fprintf (stdout, "%s\n\n",
|
||||
_(HOOK_COMMAND(ptr_hook, description)));
|
||||
if (HOOK_COMMAND(ptr_hook, args_description)
|
||||
&& HOOK_COMMAND(ptr_hook, args_description)[0])
|
||||
{
|
||||
string_iconv_fprintf (stdout, "%s\n\n",
|
||||
_(HOOK_COMMAND(ptr_hook, args_description)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,211 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2008 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* wee-debug.c: some debug functions for WeeChat */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "weechat.h"
|
||||
#include "wee-config-file.h"
|
||||
#include "wee-log.h"
|
||||
#include "wee-hook.h"
|
||||
#include "../gui/gui-buffer.h"
|
||||
#include "../gui/gui-chat.h"
|
||||
#include "../gui/gui-hotlist.h"
|
||||
#include "../gui/gui-window.h"
|
||||
#include "../plugins/plugin.h"
|
||||
|
||||
|
||||
int debug_dump_active = 0;
|
||||
|
||||
|
||||
/*
|
||||
* debug_dump: write dump to WeeChat log file
|
||||
*/
|
||||
|
||||
void
|
||||
debug_dump (int crash)
|
||||
{
|
||||
/* prevent reentrance */
|
||||
if (debug_dump_active)
|
||||
exit (EXIT_FAILURE);
|
||||
|
||||
if (crash)
|
||||
{
|
||||
debug_dump_active = 1;
|
||||
log_printf ("Very bad, WeeChat is crashing (SIGSEGV received)...");
|
||||
}
|
||||
|
||||
log_printf ("");
|
||||
if (crash)
|
||||
{
|
||||
log_printf ("****** WeeChat CRASH DUMP ******");
|
||||
log_printf ("****** Please send this file to WeeChat developers ******");
|
||||
log_printf ("****** and explain when this crash happened ******");
|
||||
}
|
||||
else
|
||||
{
|
||||
log_printf ("****** WeeChat dump request ******");
|
||||
}
|
||||
|
||||
gui_window_print_log ();
|
||||
gui_buffer_print_log ();
|
||||
gui_hotlist_print_log ();
|
||||
|
||||
hook_print_log ();
|
||||
|
||||
config_file_print_log ();
|
||||
|
||||
plugin_print_log ();
|
||||
|
||||
log_printf ("");
|
||||
log_printf ("****** End of WeeChat dump ******");
|
||||
log_printf ("");
|
||||
}
|
||||
|
||||
/*
|
||||
* debug_dump_cb: callback for "debug_dump" signal hooked
|
||||
*/
|
||||
|
||||
int
|
||||
debug_dump_cb (void *data, char *signal, char *type_data, void *signal_data)
|
||||
{
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
(void) signal;
|
||||
(void) type_data;
|
||||
(void) signal_data;
|
||||
|
||||
debug_dump (0);
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* debug_buffer_cb: callback for "debug_buffer" signal hooked
|
||||
*/
|
||||
|
||||
int
|
||||
debug_buffer_cb (void *data, char *signal, char *type_data, void *signal_data)
|
||||
{
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
(void) signal;
|
||||
(void) type_data;
|
||||
|
||||
gui_buffer_dump_hexa ((struct t_gui_buffer *)signal_data);
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* debug_windows_tree_display: display tree of windows
|
||||
*/
|
||||
|
||||
void
|
||||
debug_windows_tree_display (struct t_gui_window_tree *tree, int indent)
|
||||
{
|
||||
char format[128];
|
||||
|
||||
if (tree)
|
||||
{
|
||||
if (tree->window)
|
||||
{
|
||||
/* leaf */
|
||||
snprintf (format,
|
||||
sizeof (format),
|
||||
"%%-%dsleaf: 0x%%X (parent:0x%%X), win=0x%%X, "
|
||||
"child1=0x%%X, child2=0x%%X, %%d,%%d %%dx%%d, "
|
||||
"%%d%%%%x%%d%%%%",
|
||||
indent * 2);
|
||||
gui_chat_printf (NULL,
|
||||
format,
|
||||
" ", tree, tree->parent_node, tree->window,
|
||||
tree->child1, tree->child2,
|
||||
tree->window->win_x, tree->window->win_y,
|
||||
tree->window->win_width, tree->window->win_height,
|
||||
tree->window->win_width_pct,
|
||||
tree->window->win_height_pct);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* node */
|
||||
snprintf (format,
|
||||
sizeof (format),
|
||||
"%%-%dsnode: 0x%%X (parent:0x%%X), win=0x%%X, "
|
||||
"child1=0x%%X, child2=0x%%X)",
|
||||
indent * 2);
|
||||
gui_chat_printf (NULL,
|
||||
format,
|
||||
" ", tree, tree->parent_node, tree->window,
|
||||
tree->child1, tree->child2);
|
||||
}
|
||||
|
||||
if (tree->child1)
|
||||
debug_windows_tree_display (tree->child1, indent + 1);
|
||||
if (tree->child2)
|
||||
debug_windows_tree_display (tree->child2, indent + 1);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* debug_windows_tree_display: display tree of windows
|
||||
*/
|
||||
|
||||
void
|
||||
debug_windows_tree ()
|
||||
{
|
||||
gui_chat_printf (NULL, "");
|
||||
gui_chat_printf (NULL, "DEBUG: windows tree:");
|
||||
debug_windows_tree_display (gui_windows_tree, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* debug_windows_cb: callback for "debug_windows" signal hooked
|
||||
*/
|
||||
|
||||
int
|
||||
debug_windows_cb (void *data, char *signal, char *type_data, void *signal_data)
|
||||
{
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
(void) signal;
|
||||
(void) type_data;
|
||||
(void) signal_data;
|
||||
|
||||
debug_windows_tree ();
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* debug_init: hook signals for debug
|
||||
*/
|
||||
|
||||
void
|
||||
debug_init ()
|
||||
{
|
||||
hook_signal (NULL, "debug_dump", debug_dump_cb, NULL);
|
||||
hook_signal (NULL, "debug_buffer", debug_buffer_cb, NULL);
|
||||
hook_signal (NULL, "debug_windows", debug_windows_cb, NULL);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2008 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __WEECHAT_DEBUG_H
|
||||
#define __WEECHAT_DEBUG_H 1
|
||||
|
||||
struct t_gui_window_tree;
|
||||
|
||||
extern void debug_dump (int crash);
|
||||
extern void debug_init ();
|
||||
|
||||
#endif /* wee-debug.h */
|
||||
+18
-66
@@ -1,18 +1,18 @@
|
||||
/* ############################################################################
|
||||
* ### ___ __ ______________ _____ ###
|
||||
* ### __ | / /___________ ____/__ /_______ __ /_ ###
|
||||
* ### __ | /| / /_ _ \ _ \ / __ __ \ __ `/ __/ ###
|
||||
* ### __ |/ |/ / / __/ __/ /___ _ / / / /_/ // /_ ###
|
||||
* ### ____/|__/ \___/\___/\____/ /_/ /_/\__,_/ \__/ ###
|
||||
* ### ###
|
||||
* ### WeeChat - Wee Enhanced Environment for Chat ###
|
||||
* ### Fast & light environment for Chat ###
|
||||
* ### ###
|
||||
* ### By FlashCode <flashcode@flashtux.org> ###
|
||||
* ### ###
|
||||
* ### http://weechat.flashtux.org ###
|
||||
* ### ###
|
||||
* ############################################################################
|
||||
/* ##########################################################################
|
||||
* ## ___ __ ______________ _____ ##
|
||||
* ## __ | / /___________ ____/__ /_______ __ /_ ##
|
||||
* ## __ | /| / /_ _ \ _ \ / __ __ \ __ `/ __/ ##
|
||||
* ## __ |/ |/ / / __/ __/ /___ _ / / / /_/ // /_ ##
|
||||
* ## ____/|__/ \___/\___/\____/ /_/ /_/\__,_/ \__/ ##
|
||||
* ## ##
|
||||
* ## WeeChat - Wee Enhanced Environment for Chat ##
|
||||
* ## Fast, light, extensible chat client ##
|
||||
* ## ##
|
||||
* ## By FlashCode <flashcode@flashtux.org> ##
|
||||
* ## ##
|
||||
* ## http://weechat.flashtux.org ##
|
||||
* ## ##
|
||||
* ##########################################################################
|
||||
*
|
||||
* Copyright (c) 2003-2008 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
@@ -54,19 +54,16 @@
|
||||
#include "wee-backtrace.h"
|
||||
#include "wee-command.h"
|
||||
#include "wee-config.h"
|
||||
#include "wee-debug.h"
|
||||
#include "wee-hook.h"
|
||||
#include "wee-log.h"
|
||||
#include "wee-upgrade.h"
|
||||
#include "wee-string.h"
|
||||
#include "wee-utf8.h"
|
||||
#include "wee-util.h"
|
||||
#include "../gui/gui-buffer.h"
|
||||
#include "../gui/gui-chat.h"
|
||||
#include "../gui/gui-color.h"
|
||||
#include "../gui/gui-hotlist.h"
|
||||
#include "../gui/gui-main.h"
|
||||
#include "../gui/gui-keyboard.h"
|
||||
#include "../gui/gui-window.h"
|
||||
#include "../plugins/plugin.h"
|
||||
|
||||
|
||||
@@ -482,52 +479,6 @@ weechat_shutdown (int return_code, int crash)
|
||||
exit (return_code);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_dump: write dump to WeeChat log file
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_dump (int crash)
|
||||
{
|
||||
/* prevent reentrance */
|
||||
if (sigsegv)
|
||||
exit (EXIT_FAILURE);
|
||||
|
||||
if (crash)
|
||||
{
|
||||
sigsegv = 1;
|
||||
log_printf ("Very bad, WeeChat is crashing (SIGSEGV received)...");
|
||||
}
|
||||
|
||||
log_printf ("");
|
||||
if (crash)
|
||||
{
|
||||
log_printf ("****** WeeChat CRASH DUMP ******");
|
||||
log_printf ("****** Please send this file to WeeChat developers ******");
|
||||
log_printf ("****** and explain when this crash happened ******");
|
||||
}
|
||||
else
|
||||
{
|
||||
log_printf ("****** WeeChat dump request ******");
|
||||
}
|
||||
|
||||
gui_window_print_log ();
|
||||
gui_buffer_print_log ();
|
||||
gui_hotlist_print_log ();
|
||||
|
||||
hook_print_log ();
|
||||
|
||||
config_file_print_log ();
|
||||
|
||||
plugin_print_log ();
|
||||
|
||||
hook_signal_send ("dump_data", WEECHAT_HOOK_SIGNAL_STRING, NULL);
|
||||
|
||||
log_printf ("");
|
||||
log_printf ("****** End of WeeChat dump ******");
|
||||
log_printf ("");
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_sigsegv: SIGSEGV handler: save crash log to
|
||||
* <weechat_home>/weechat.log and exit
|
||||
@@ -536,7 +487,7 @@ weechat_dump (int crash)
|
||||
void
|
||||
weechat_sigsegv ()
|
||||
{
|
||||
weechat_dump (1);
|
||||
debug_dump (1);
|
||||
unhook_all ();
|
||||
gui_main_end ();
|
||||
|
||||
@@ -588,6 +539,7 @@ main (int argc, char *argv[])
|
||||
util_catch_signal (SIGSEGV,
|
||||
&weechat_sigsegv); /* crash dump for SIGSEGV signal */
|
||||
hook_init (); /* initialize hooks */
|
||||
debug_init (); /* hook signals for debug */
|
||||
gui_main_pre_init (&argc, &argv); /* pre-initiliaze interface */
|
||||
weechat_init_vars (); /* initialize some variables */
|
||||
command_init (); /* initialize WeeChat commands */
|
||||
|
||||
Reference in New Issue
Block a user