Enlightenment CVS committal Author : raster Project : e17 Module : apps/e
Dir : e17/apps/e/src/bin Modified Files: e_main.c e_module.c e_module.h e_signals.c Log Message: detect crashes at startup or early and enable "safe mode" so if you hit restart e will not load modules - maybe safe mode should also restore default theme and other things too later... =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_main.c,v retrieving revision 1.172 retrieving revision 1.173 diff -u -3 -r1.172 -r1.173 --- e_main.c 23 Jul 2006 11:22:13 -0000 1.172 +++ e_main.c 30 Jul 2006 19:34:05 -0000 1.173 @@ -49,9 +49,11 @@ int i; int nostartup = 0; int after_restart = 0; + int safe_mode = 0; char buf[PATH_MAX]; char *s; struct sigaction action; + double t, tstart; /* trap deadly bug signals and allow some form of sane recovery */ /* or ability to gdb attach and debug at this point - better than your */ /* wm/desktop vanishing and not knowing what happened */ @@ -92,6 +94,22 @@ sigemptyset(&action.sa_mask); sigaction(SIGABRT, &action, NULL); + t = ecore_time_get(); + s = getenv("START_TIME"); + if ((s) && (getenv("CRASHED"))) + { + tstart = atof(s); + if ((t - tstart) < 5.0) + { + safe_mode = 1; + } + } + e_util_env_set("CRASHED", NULL); + + tstart = t; + snprintf(buf, sizeof(buf), "%1.1f", tstart); + e_util_env_set("START_TIME", buf); + /* FIXME: this is the init code for letting e be relocatable. right now * its not used - so i want to see if it can reliably determine its exe * prefix @@ -296,7 +314,7 @@ "Perhaps you are out of memory?")); _e_main_shutdown(-1); } - if(!ecore_event_handler_add(ECORE_EVENT_SIGNAL_HUP, _e_main_cb_signal_hup, NULL)) + if (!ecore_event_handler_add(ECORE_EVENT_SIGNAL_HUP, _e_main_cb_signal_hup, NULL)) { e_error_message_show(_("Enlightenment cannot set up a HUP signal handler.\n" "Perhaps you are out of memory?")); @@ -314,7 +332,7 @@ _e_main_shutdown(-1); } _e_main_shutdown_push(_e_main_x_shutdown); - /* init x */ + /* init white box of death alert */ if (!e_alert_init(NULL)) { e_error_message_show(_("Enlightenment cannot initialize its emergency alert system.\n" @@ -374,6 +392,7 @@ "Ecore and check they support the Software Buffer rendering engine.")); _e_main_shutdown(-1); } + { Ecore_Evas *ee; Evas_Object *im; @@ -599,6 +618,21 @@ _e_main_shutdown(-1); } _e_main_shutdown_push(e_color_class_shutdown); + /* load modules */ + if (!safe_mode) + e_module_all_load(); + else + { + e_int_config_modules(e_container_current_get(e_manager_current_get())); + e_error_message_show + (_("Enlightenment crashed early on start and has<br>" + "been restarted. All modules have been disabled<br>" + "and will not be loaded to help remove any problem<br>" + "modules from your configuration. The module<br>" + "configuration dialog should let you select your<br>" + "modules again.")); + e_config_save_queue(); + } /* setup gadcon */ if (!e_gadcon_init()) { =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_module.c,v retrieving revision 1.61 retrieving revision 1.62 diff -u -3 -r1.61 -r1.62 --- e_module.c 5 Jul 2006 21:23:42 -0000 1.61 +++ e_module.c 30 Jul 2006 19:34:05 -0000 1.62 @@ -35,6 +35,33 @@ EAPI int e_module_init(void) { + return 1; +} + +EAPI int +e_module_shutdown(void) +{ + Evas_List *l, *tmp; + +#ifdef HAVE_VALGRIND + /* do a leak check now before we dlclose() all those plugins, cause + * that means we won't get a decent backtrace to leaks in there + */ + VALGRIND_DO_LEAK_CHECK +#endif + + for (l = _e_modules; l;) + { + tmp = l; + l = l->next; + e_object_del(E_OBJECT(tmp->data)); + } + return 1; +} + +EAPI void +e_module_all_load(void) +{ Evas_List *pl = NULL, *l; for (l = e_config->modules; l;) @@ -59,29 +86,6 @@ e_config_save_queue(); } } - - return 1; -} - -EAPI int -e_module_shutdown(void) -{ - Evas_List *l, *tmp; - -#ifdef HAVE_VALGRIND - /* do a leak check now before we dlclose() all those plugins, cause - * that means we won't get a decent backtrace to leaks in there - */ - VALGRIND_DO_LEAK_CHECK -#endif - - for (l = _e_modules; l;) - { - tmp = l; - l = l->next; - e_object_del(E_OBJECT(tmp->data)); - } - return 1; } EAPI E_Module * =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_module.h,v retrieving revision 1.14 retrieving revision 1.15 diff -u -3 -r1.14 -r1.15 --- e_module.h 3 Jul 2006 04:08:47 -0000 1.14 +++ e_module.h 30 Jul 2006 19:34:05 -0000 1.15 @@ -48,6 +48,7 @@ EAPI int e_module_init(void); EAPI int e_module_shutdown(void); +EAPI void e_module_all_load(void); EAPI E_Module *e_module_new(const char *name); EAPI int e_module_save(E_Module *m); EAPI const char *e_module_dir_get(E_Module *m); =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_signals.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -3 -r1.12 -r1.13 --- e_signals.c 2 Apr 2006 04:18:18 -0000 1.12 +++ e_signals.c 30 Jul 2006 19:34:05 -0000 1.13 @@ -25,6 +25,7 @@ ecore_x_keyboard_ungrab(); ecore_x_ungrab(); ecore_x_sync(); + e_util_env_set("CRASHED", "SEGV"); e_alert_show("This is very bad. Enlightenment has segfaulted.\n" "This is not meant to happen and is likely a sign of a\n" "bug in Enlightenment or the libraries it relies on.\n" @@ -50,6 +51,7 @@ ecore_x_keyboard_ungrab(); ecore_x_ungrab(); ecore_x_sync(); + e_util_env_set("CRASHED", "SEGV"); e_alert_show("This is very bad. Enlightenment has segfaulted.\n" "This is not meant to happen and is likely a sign of a\n" "bug in Enlightenment or the libraries it relies on.\n" @@ -76,6 +78,7 @@ ecore_x_keyboard_ungrab(); ecore_x_ungrab(); ecore_x_sync(); + e_util_env_set("CRASHED", "ILL"); e_alert_show("This is very bad. Enlightenment has executed and illegal\n" "instruction. This is most likely because Enlightenment or\n" "a library it depends on has been compiled for a CPU type\n" @@ -102,6 +105,7 @@ ecore_x_keyboard_ungrab(); ecore_x_ungrab(); ecore_x_sync(); + e_util_env_set("CRASHED", "FPE"); e_alert_show("This is very bad. Enlightenment has recieved a floating\n" "point exception. This is probably due to a divide by 0\n" "in Enlightenment or a library it depends on.\n" @@ -127,6 +131,7 @@ ecore_x_keyboard_ungrab(); ecore_x_ungrab(); ecore_x_sync(); + e_util_env_set("CRASHED", "BUS"); e_alert_show("This is very bad. Enlightenment has recieved a bus error.\n" "This could be for many reasons - accessing memory not in\n" "its available address space or unable to be paged in.\n" @@ -152,6 +157,7 @@ ecore_x_keyboard_ungrab(); ecore_x_ungrab(); ecore_x_sync(); + e_util_env_set("CRASHED", "ABRT"); e_alert_show("This is very bad. Enlightenment has recieved an abort.\n" "This could be for many reasons - accessing memory not in\n" "its available address space or unable to be paged in.\n" ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs