From d2a239054f3b1eba1c87197b47ce13ee91bbf27d Mon Sep 17 00:00:00 2001 From: Nick Schermer Date: Thu, 6 Jan 2011 20:27:12 +0100 Subject: [PATCH] Move gdb/valgrind debug messages to main. --- common/panel-debug.c | 44 ----------------------------------- common/panel-debug.h | 2 -- panel/main.c | 41 ++++++++++++++++++++++++++++++++ panel/panel-plugin-external.c | 4 ++-- 4 files changed, 43 insertions(+), 48 deletions(-) diff --git a/common/panel-debug.c b/common/panel-debug.c index a78922b9..6eecdd54 100644 --- a/common/panel-debug.c +++ b/common/panel-debug.c @@ -109,50 +109,6 @@ panel_debug_print (PanelDebugFlag domain, -void -panel_debug_notify_proxy (void) -{ - gchar *path; - const gchar *proxy_application; - - if (G_UNLIKELY (PANEL_HAS_FLAG (panel_debug_flags, PANEL_DEBUG_GDB))) - proxy_application = "gdb"; - else if (G_UNLIKELY (PANEL_HAS_FLAG (panel_debug_flags, PANEL_DEBUG_VALGRIND))) - proxy_application = "valgrind"; - else - return; - - path = g_find_program_in_path (proxy_application); - if (G_LIKELY (path != NULL)) - { - g_printerr (PACKAGE_NAME "(debug): running plugins with %s; " - "log files stored in %s\n", path, g_get_tmp_dir ()); - g_free (path); - - if (PANEL_HAS_FLAG (panel_debug_flags, PANEL_DEBUG_GDB)) - { - /* performs sanity checks on the released memory slices */ - g_setenv ("G_SLICE", "debug-blocks", TRUE); - } - else if (PANEL_HAS_FLAG (panel_debug_flags, PANEL_DEBUG_VALGRIND)) - { - /* use g_malloc() and g_free() instead of slices */ - g_setenv ("G_SLICE", "always-malloc", TRUE); - g_setenv ("G_DEBUG", "gc-friendly", TRUE); - } - } - else - { - /* make sure external plugins are not started in one of the proxies */ - PANEL_UNSET_FLAG (panel_debug_flags, PANEL_DEBUG_GDB | PANEL_DEBUG_VALGRIND); - - g_printerr (PACKAGE_NAME "(debug): %s not found in PATH\n", - proxy_application); - } -} - - - gboolean panel_debug_has_domain (PanelDebugFlag domain) { diff --git a/common/panel-debug.h b/common/panel-debug.h index 5c55cf13..7ca93d50 100644 --- a/common/panel-debug.h +++ b/common/panel-debug.h @@ -41,8 +41,6 @@ typedef enum } PanelDebugFlag; -void panel_debug_notify_proxy (void); - gboolean panel_debug_has_domain (PanelDebugFlag domain); void panel_debug (PanelDebugFlag domain, diff --git a/panel/main.c b/panel/main.c index a23cf0b1..e8ae3165 100644 --- a/panel/main.c +++ b/panel/main.c @@ -162,6 +162,47 @@ panel_sm_client_save_state (XfceSMClient *sm_client, +static void +panel_debug_notify_proxy (void) +{ + gchar *path; + const gchar *proxy_cmd; + + if (G_UNLIKELY (panel_debug_has_domain (PANEL_DEBUG_GDB))) + proxy_cmd = "gdb"; + else if (G_UNLIKELY (panel_debug_has_domain (PANEL_DEBUG_VALGRIND))) + proxy_cmd = "valgrind"; + else + return; + + path = g_find_program_in_path (proxy_cmd); + if (G_LIKELY (path != NULL)) + { + panel_debug (PANEL_DEBUG_MAIN, + "running external plugins with %s, logs stored in %s", + path, g_get_tmp_dir ()); + g_free (path); + + if (panel_debug_has_domain (PANEL_DEBUG_GDB)) + { + /* performs sanity checks on the released memory slices */ + g_setenv ("G_SLICE", "debug-blocks", TRUE); + } + else if (panel_debug_has_domain (PANEL_DEBUG_VALGRIND)) + { + /* use g_malloc() and g_free() instead of slices */ + g_setenv ("G_SLICE", "always-malloc", TRUE); + g_setenv ("G_DEBUG", "gc-friendly", TRUE); + } + } + else + { + panel_debug (PANEL_DEBUG_MAIN, "%s not found in PATH", proxy_cmd); + } +} + + + gint main (gint argc, gchar **argv) { diff --git a/panel/panel-plugin-external.c b/panel/panel-plugin-external.c index e43b57cb..f4d434aa 100644 --- a/panel/panel-plugin-external.c +++ b/panel/panel-plugin-external.c @@ -510,8 +510,8 @@ panel_plugin_external_child_spawn (PanelPluginExternal *external) cmd_line = NULL; program = NULL; - /* note that if the program was not found in PATH, we already - * warned for it in panel_debug_init, so no need to do that again */ + /* note that if the program was not found in PATH, we already warned + * for it in panel_debug_notify_proxy, so no need to do that again */ if (panel_debug_has_domain (PANEL_DEBUG_GDB)) { program = g_find_program_in_path ("gdb");