Browse Source

Move gdb/valgrind debug messages to main.

upstream/xfce4-panel-4.10.1
Nick Schermer 12 years ago
parent
commit
d2a239054f
  1. 44
      common/panel-debug.c
  2. 2
      common/panel-debug.h
  3. 41
      panel/main.c
  4. 4
      panel/panel-plugin-external.c

44
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)
{

2
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,

41
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)
{

4
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");

Loading…
Cancel
Save