Commit daa61318 authored by Darin Adler's avatar Darin Adler

Made it stop in the debugger for a g_warning, but not abort if the

debugger is not running.
parent b7c12944
2000-01-14 Darin Adler <darin@eazel.com>
Fixed our handling of warnings and criticals.
* src/ntl-main.c: Added new functions that stop in the debugger
when you hit a g_warning or a critical error, only if the
environment variable NAUTILUS_DEBUG is set. This is better than
the way the old code made everything fatal, since it doesn't do
anything if the debugger isn't running.
2000-01-14 Darin Adler <darin@eazel.com>
Turned on gradients for backgrounds.
......
......@@ -34,7 +34,36 @@
#include <libnautilus/nautilus-lib-self-check-functions.h>
#include <libnautilus/nautilus-self-checks.h>
int main(int argc, char *argv[])
/* Raise a SIGINT signal to get the attention of the debugger.
When not running under the debugger, we don't want to stop,
so we ignore the signal for just the moment that we raise it.
*/
static void
stop_in_debugger (void)
{
void (* saved_handler) (int);
saved_handler = signal (SIGINT, SIG_IGN);
raise (SIGINT);
signal (SIGINT, saved_handler);
}
/* Stop in the debugger after running the default log handler.
This makes certain kinds of messages stop in the debugger
without making them fatal.
*/
static void
nautilus_stop_after_default_log_handler (const char *domain,
GLogLevelFlags level,
const char *message,
gpointer data)
{
g_log_default_handler (domain, level, message, data);
stop_in_debugger ();
}
int
main(int argc, char *argv[])
{
poptContext ctx;
CORBA_Environment ev;
......@@ -51,10 +80,11 @@ int main(int argc, char *argv[])
#endif
{ NULL, '\0', 0, NULL, 0, NULL, NULL }
};
/* Make criticals and warnings into errors if NAUTILUS_DEBUG is set. */
/* Make criticals and warnings stop in the debugger if NAUTILUS_DEBUG is set. */
if (getenv("NAUTILUS_DEBUG") != NULL)
g_log_set_always_fatal (G_LOG_FATAL_MASK | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING);
g_log_set_handler (NULL, G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING,
nautilus_stop_after_default_log_handler, NULL);
/* Initialize the services that we use. */
CORBA_exception_init(&ev);
......
......@@ -34,7 +34,36 @@
#include <libnautilus/nautilus-lib-self-check-functions.h>
#include <libnautilus/nautilus-self-checks.h>
int main(int argc, char *argv[])
/* Raise a SIGINT signal to get the attention of the debugger.
When not running under the debugger, we don't want to stop,
so we ignore the signal for just the moment that we raise it.
*/
static void
stop_in_debugger (void)
{
void (* saved_handler) (int);
saved_handler = signal (SIGINT, SIG_IGN);
raise (SIGINT);
signal (SIGINT, saved_handler);
}
/* Stop in the debugger after running the default log handler.
This makes certain kinds of messages stop in the debugger
without making them fatal.
*/
static void
nautilus_stop_after_default_log_handler (const char *domain,
GLogLevelFlags level,
const char *message,
gpointer data)
{
g_log_default_handler (domain, level, message, data);
stop_in_debugger ();
}
int
main(int argc, char *argv[])
{
poptContext ctx;
CORBA_Environment ev;
......@@ -51,10 +80,11 @@ int main(int argc, char *argv[])
#endif
{ NULL, '\0', 0, NULL, 0, NULL, NULL }
};
/* Make criticals and warnings into errors if NAUTILUS_DEBUG is set. */
/* Make criticals and warnings stop in the debugger if NAUTILUS_DEBUG is set. */
if (getenv("NAUTILUS_DEBUG") != NULL)
g_log_set_always_fatal (G_LOG_FATAL_MASK | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING);
g_log_set_handler (NULL, G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING,
nautilus_stop_after_default_log_handler, NULL);
/* Initialize the services that we use. */
CORBA_exception_init(&ev);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment