зеркало из https://github.com/mozilla/pjs.git
Hook into glib's logging function so we can get stacks for glib assertions/warnings. b=381133 r=bsmedberg
This commit is contained in:
Родитель
cffe7e3204
Коммит
acbaf1980a
|
@ -157,6 +157,31 @@ void beos_signal_handler(int signum) {
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
static GLogFunc orig_log_func = NULL;
|
||||
|
||||
extern "C" {
|
||||
static void
|
||||
my_glib_log_func(const gchar *log_domain, GLogLevelFlags log_level,
|
||||
const gchar *message, gpointer user_data);
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
my_glib_log_func(const gchar *log_domain, GLogLevelFlags log_level,
|
||||
const gchar *message, gpointer user_data)
|
||||
{
|
||||
orig_log_func(log_domain, log_level, message, NULL);
|
||||
|
||||
if (log_level & (G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING)) {
|
||||
NS_DebugBreak(NS_DEBUG_ASSERTION, message, "glib assertion", __FILE__, __LINE__);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void InstallUnixSignalHandlers(const char *ProgramName)
|
||||
{
|
||||
PL_strncpy(_progname,ProgramName, (sizeof(_progname)-1) );
|
||||
|
@ -228,4 +253,17 @@ void InstallUnixSignalHandlers(const char *ProgramName)
|
|||
#ifdef XP_BEOS
|
||||
signal(SIGTERM, beos_signal_handler);
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
const char *assertString = PR_GetEnv("XPCOM_DEBUG_BREAK");
|
||||
if (assertString &&
|
||||
(!strcmp(assertString, "suspend") ||
|
||||
!strcmp(assertString, "stack") ||
|
||||
!strcmp(assertString, "abort") ||
|
||||
!strcmp(assertString, "trap") ||
|
||||
!strcmp(assertString, "break"))) {
|
||||
// Override the default glib logging function so we get stacks for it too.
|
||||
orig_log_func = g_log_set_default_handler(my_glib_log_func, NULL);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче