Mercurial > hg > xemacs-beta
comparison src/emacs.c @ 263:727739f917cb r20-5b30
Import from CVS: tag r20-5b30
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:24:41 +0200 |
parents | 11cf20601dec |
children | 8efd647ea9ca |
comparison
equal
deleted
inserted
replaced
262:9d8607af9e13 | 263:727739f917cb |
---|---|
84 #ifdef DOUG_LEA_MALLOC | 84 #ifdef DOUG_LEA_MALLOC |
85 # include <malloc.h> | 85 # include <malloc.h> |
86 /* Preserves a pointer to the memory allocated that copies that | 86 /* Preserves a pointer to the memory allocated that copies that |
87 static data inside glibc's malloc. */ | 87 static data inside glibc's malloc. */ |
88 void *malloc_state_ptr; | 88 void *malloc_state_ptr; |
89 /*#define SLB_MEMORY_CHECKING 1*/ | |
90 /* I have observed free being passed the value 0x01 in gdb from somewhere */ | |
91 /* in the locale initialization, except that as soon as the following */ | |
92 /* monitoring code was added, the problem went away. I don't trust gdb */ | |
93 /* at all with glibc, sigh. -slb */ | |
94 #ifdef SLB_MEMORY_CHECKING | |
95 void slb_memory_checker(__malloc_ptr_t); | |
96 #endif | |
89 #endif | 97 #endif |
90 | 98 |
91 /* Variable whose value is symbol giving operating system type. */ | 99 /* Variable whose value is symbol giving operating system type. */ |
92 Lisp_Object Vsystem_type; | 100 Lisp_Object Vsystem_type; |
93 | 101 |
498 #ifndef SYSTEM_MALLOC | 506 #ifndef SYSTEM_MALLOC |
499 /* Make sure that any libraries we link against haven't installed a | 507 /* Make sure that any libraries we link against haven't installed a |
500 hook for a gmalloc of a potentially incompatible version. */ | 508 hook for a gmalloc of a potentially incompatible version. */ |
501 __malloc_hook = NULL; | 509 __malloc_hook = NULL; |
502 __realloc_hook = NULL; | 510 __realloc_hook = NULL; |
511 #ifndef SLB_MEMORY_CHECKING | |
503 __free_hook = NULL; | 512 __free_hook = NULL; |
513 #endif | |
504 #endif /* not SYSTEM_MALLOC */ | 514 #endif /* not SYSTEM_MALLOC */ |
505 | 515 |
506 noninteractive = 0; | 516 noninteractive = 0; |
507 | 517 |
508 #ifdef NeXT | 518 #ifdef NeXT |
741 if ((dpy = getenv ("DISPLAY")) && dpy[0]) | 751 if ((dpy = getenv ("DISPLAY")) && dpy[0]) |
742 display_use = "x"; | 752 display_use = "x"; |
743 | 753 |
744 #endif /* HAVE_X_WINDOWS */ | 754 #endif /* HAVE_X_WINDOWS */ |
745 #ifdef HAVE_MS_WINDOWS | 755 #ifdef HAVE_MS_WINDOWS |
746 if (!noninteractive) | 756 if (strcmp(display_use, "x") != 0) |
747 display_use = "mswindows"; | 757 display_use = "mswindows"; |
748 #endif /* HAVE_MS_WINDOWS */ | 758 #endif /* HAVE_MS_WINDOWS */ |
749 } | 759 } |
750 #endif /* HAVE_WINDOW_SYSTEM */ | 760 #endif /* HAVE_WINDOW_SYSTEM */ |
751 | 761 |
933 syms_of_objects_mswindows (); | 943 syms_of_objects_mswindows (); |
934 syms_of_select_mswindows (); | 944 syms_of_select_mswindows (); |
935 #ifdef HAVE_MENUBARS | 945 #ifdef HAVE_MENUBARS |
936 syms_of_menubar_mswindows (); | 946 syms_of_menubar_mswindows (); |
937 #endif | 947 #endif |
938 #endif | 948 #ifdef HAVE_MSW_C_DIRED |
949 syms_of_dired_mswindows (); | |
950 #endif | |
951 #endif /* HAVE_MS_WINDOWS */ | |
939 | 952 |
940 #ifdef MULE | 953 #ifdef MULE |
941 syms_of_mule (); | 954 syms_of_mule (); |
942 syms_of_mule_ccl (); | 955 syms_of_mule_ccl (); |
943 syms_of_mule_charset (); | 956 syms_of_mule_charset (); |
1103 lstream_type_create (); | 1116 lstream_type_create (); |
1104 #ifdef FILE_CODING | 1117 #ifdef FILE_CODING |
1105 lstream_type_create_mule_coding (); | 1118 lstream_type_create_mule_coding (); |
1106 #endif | 1119 #endif |
1107 lstream_type_create_print (); | 1120 lstream_type_create_print (); |
1121 | |
1122 /* Initialize processes implementation. | |
1123 The functions may make exactly the following function/macro calls: | |
1124 | |
1125 PROCESS_HAS_METHOD() | |
1126 */ | |
1127 #ifdef HAVE_UNIX_PROCESSES | |
1128 process_type_create_unix (); | |
1129 #endif | |
1130 #ifdef HAVE_WIN32_PROCESSES | |
1131 process_type_create_mswindows (); | |
1132 #endif | |
1108 | 1133 |
1109 /* Now initialize most variables. | 1134 /* Now initialize most variables. |
1110 | 1135 |
1111 These functions may do exactly the following: | 1136 These functions may do exactly the following: |
1112 | 1137 |
1214 vars_of_menubar (); | 1239 vars_of_menubar (); |
1215 #endif | 1240 #endif |
1216 vars_of_minibuf (); | 1241 vars_of_minibuf (); |
1217 vars_of_objects (); | 1242 vars_of_objects (); |
1218 vars_of_print (); | 1243 vars_of_print (); |
1244 | |
1219 #ifndef NO_SUBPROCESSES | 1245 #ifndef NO_SUBPROCESSES |
1220 vars_of_process (); | 1246 vars_of_process (); |
1221 #endif | 1247 #ifdef HAVE_UNIX_PROCESSES |
1248 vars_of_process_unix (); | |
1249 #endif | |
1250 #ifdef HAVE_WIN32_PROCESSES | |
1251 vars_of_process_mswindows (); | |
1252 #endif | |
1253 #endif | |
1254 | |
1222 vars_of_profile (); | 1255 vars_of_profile (); |
1223 #if defined (HAVE_MMAP) && defined (REL_ALLOC) && !defined(DOUG_LEA_MALLOC) | 1256 #if defined (HAVE_MMAP) && defined (REL_ALLOC) && !defined(DOUG_LEA_MALLOC) |
1224 vars_of_ralloc (); | 1257 vars_of_ralloc (); |
1225 #endif /* HAVE_MMAP && REL_ALLOC */ | 1258 #endif /* HAVE_MMAP && REL_ALLOC */ |
1226 vars_of_redisplay (); | 1259 vars_of_redisplay (); |
1280 vars_of_scrollbar_mswindows (); | 1313 vars_of_scrollbar_mswindows (); |
1281 #endif | 1314 #endif |
1282 #ifdef HAVE_MENUBARS | 1315 #ifdef HAVE_MENUBARS |
1283 vars_of_menubar_mswindows (); | 1316 vars_of_menubar_mswindows (); |
1284 #endif | 1317 #endif |
1285 #endif | 1318 #ifdef HAVE_MSW_C_DIRED |
1319 vars_of_dired_mswindows (); | |
1320 #endif | |
1321 #endif /* HAVE_MS_WINDOWS */ | |
1286 | 1322 |
1287 #ifdef MULE | 1323 #ifdef MULE |
1288 vars_of_mule (); | 1324 vars_of_mule (); |
1289 vars_of_mule_charset (); | 1325 vars_of_mule_charset (); |
1290 #endif | 1326 #endif |
1856 report_pure_usage (0, 0); | 1892 report_pure_usage (0, 0); |
1857 #endif | 1893 #endif |
1858 LONGJMP (run_temacs_catch, 1); | 1894 LONGJMP (run_temacs_catch, 1); |
1859 return Qnil; /* not reached; warning suppression */ | 1895 return Qnil; /* not reached; warning suppression */ |
1860 } | 1896 } |
1897 | |
1898 #ifdef SLB_MEMORY_CHECKING | |
1899 void | |
1900 slb_memory_checker(__malloc_ptr_t mem) | |
1901 { | |
1902 unsigned int u = (unsigned int)mem; | |
1903 /* 08f6b0a8 */ | |
1904 if (u < 0x08000000) { | |
1905 printf("free(%08x)\n", u); | |
1906 /* abort(); */ | |
1907 } else { | |
1908 __free_hook = 0; | |
1909 | |
1910 free(mem); | |
1911 | |
1912 __free_hook = slb_memory_checker; | |
1913 } | |
1914 } | |
1915 #endif | |
1861 | 1916 |
1862 /* ARGSUSED */ | 1917 /* ARGSUSED */ |
1863 int | 1918 int |
1864 main (int argc, char **argv, char **envp) | 1919 main (int argc, char **argv, char **envp) |
1865 { | 1920 { |
1892 #ifdef QUANTIFY | 1947 #ifdef QUANTIFY |
1893 quantify_stop_recording_data (); | 1948 quantify_stop_recording_data (); |
1894 quantify_clear_data (); | 1949 quantify_clear_data (); |
1895 #endif /* QUANTIFY */ | 1950 #endif /* QUANTIFY */ |
1896 | 1951 |
1952 #ifdef SLB_MEMORY_CHECKING | |
1953 __free_hook = slb_memory_checker; | |
1954 #endif | |
1897 suppress_early_backtrace = 0; | 1955 suppress_early_backtrace = 0; |
1898 lim_data = 0; /* force reinitialization of this variable */ | 1956 lim_data = 0; /* force reinitialization of this variable */ |
1899 | 1957 |
1900 /* Lisp_Object must fit in a word; check VALBITS and GCTYPEBITS */ | 1958 /* Lisp_Object must fit in a word; check VALBITS and GCTYPEBITS */ |
1901 assert (sizeof (Lisp_Object) == sizeof (void *)); | 1959 assert (sizeof (Lisp_Object) == sizeof (void *)); |
2048 | 2106 |
2049 #ifdef QUANTIFY | 2107 #ifdef QUANTIFY |
2050 quantify_stop_recording_data (); | 2108 quantify_stop_recording_data (); |
2051 #endif /* QUANTIFY */ | 2109 #endif /* QUANTIFY */ |
2052 | 2110 |
2111 #if 0 | |
2053 /* This is absolutely the most important thing to do, so make sure | 2112 /* This is absolutely the most important thing to do, so make sure |
2054 we do it now, before anything else. We might have crashed and | 2113 we do it now, before anything else. We might have crashed and |
2055 be in a weird inconsistent state, and potentially anything could | 2114 be in a weird inconsistent state, and potentially anything could |
2056 set off another protection fault and cause us to bail out | 2115 set off another protection fault and cause us to bail out |
2057 immediately. */ | 2116 immediately. */ |
2117 /* I'm not removing the code entirely, yet. We have run up against | |
2118 a spate of problems in diagnosing crashes due to crashes within | |
2119 crashes. It has very definitely been determined that code called | |
2120 during auto-saving cannot work if XEmacs crashed inside of GC. | |
2121 We already auto-save on an itimer so there cannot be too much | |
2122 unsaved stuff around, and if we get better crash reports we might | |
2123 be able to get more problems fixed so I'm disabling this. -slb */ | |
2058 Fdo_auto_save (Qt, Qnil); /* do this before anything hazardous */ | 2124 Fdo_auto_save (Qt, Qnil); /* do this before anything hazardous */ |
2125 #endif | |
2059 | 2126 |
2060 fflush (stdout); | 2127 fflush (stdout); |
2061 reset_all_consoles (); | 2128 reset_all_consoles (); |
2062 if (sig && sig != SIGTERM) | 2129 if (sig && sig != SIGTERM) |
2063 { | 2130 { |