comparison src/dumper.c @ 446:1ccc32a20af4 r21-2-38

Import from CVS: tag r21-2-38
author cvs
date Mon, 13 Aug 2007 11:37:21 +0200
parents abe6d1db359e
children 3d3049ae1304
comparison
equal deleted inserted replaced
445:34f3776fcf0e 446:1ccc32a20af4
166 } pdump_struct_list; 166 } pdump_struct_list;
167 167
168 static pdump_entry_list pdump_object_table[256]; 168 static pdump_entry_list pdump_object_table[256];
169 static pdump_entry_list pdump_opaque_data_list; 169 static pdump_entry_list pdump_opaque_data_list;
170 static pdump_struct_list pdump_struct_table; 170 static pdump_struct_list pdump_struct_table;
171 static pdump_entry_list_elmt *pdump_qnil;
172 171
173 static int pdump_alert_undump_object[256]; 172 static int pdump_alert_undump_object[256];
174 173
175 static unsigned long cur_offset; 174 static unsigned long cur_offset;
176 static size_t max_size; 175 static size_t max_size;
355 goto restart; 354 goto restart;
356 case XD_SIZE_T: 355 case XD_SIZE_T:
357 case XD_INT: 356 case XD_INT:
358 case XD_LONG: 357 case XD_LONG:
359 case XD_BYTECOUNT: 358 case XD_BYTECOUNT:
360 case XD_LO_RESET_NIL:
361 case XD_INT_RESET: 359 case XD_INT_RESET:
362 case XD_LO_LINK: 360 case XD_LO_LINK:
363 break; 361 break;
364 case XD_OPAQUE_DATA_PTR: 362 case XD_OPAQUE_DATA_PTR:
365 { 363 {
540 case XD_SIZE_T: 538 case XD_SIZE_T:
541 case XD_INT: 539 case XD_INT:
542 case XD_LONG: 540 case XD_LONG:
543 case XD_BYTECOUNT: 541 case XD_BYTECOUNT:
544 break; 542 break;
545 case XD_LO_RESET_NIL:
546 {
547 EMACS_INT num = desc[pos].data1;
548 int j;
549 if (XD_IS_INDIRECT (num))
550 num = pdump_get_indirect_count (num, desc, elmt->obj);
551 for (j=0; j<num; j++)
552 ((EMACS_INT *)rdata)[j] = pdump_qnil->save_offset;
553 break;
554 }
555 case XD_INT_RESET: 543 case XD_INT_RESET:
556 { 544 {
557 EMACS_INT val = desc[pos].data1; 545 EMACS_INT val = desc[pos].data1;
558 if (XD_IS_INDIRECT (val)) 546 if (XD_IS_INDIRECT (val))
559 val = pdump_get_indirect_count (val, desc, elmt->obj); 547 val = pdump_get_indirect_count (val, desc, elmt->obj);
671 XSETOBJ (*pobj, (char *) XPNTR (*pobj) + delta); 659 XSETOBJ (*pobj, (char *) XPNTR (*pobj) + delta);
672 660
673 break; 661 break;
674 } 662 }
675 case XD_LISP_OBJECT_ARRAY: 663 case XD_LISP_OBJECT_ARRAY:
676 case XD_LO_RESET_NIL:
677 { 664 {
678 EMACS_INT num = desc[pos].data1; 665 EMACS_INT num = desc[pos].data1;
679 int j; 666 int j;
680 if (XD_IS_INDIRECT (num)) 667 if (XD_IS_INDIRECT (num))
681 num = pdump_get_indirect_count (num, desc, data); 668 num = pdump_get_indirect_count (num, desc, data);
903 int i; 890 int i;
904 Lisp_Object t_console, t_device, t_frame; 891 Lisp_Object t_console, t_device, t_frame;
905 int none; 892 int none;
906 dump_header hd; 893 dump_header hd;
907 894
895 flush_all_buffer_local_cache ();
896
908 /* These appear in a DEFVAR_LISP, which does a staticpro() */ 897 /* These appear in a DEFVAR_LISP, which does a staticpro() */
909 t_console = Vterminal_console; 898 t_console = Vterminal_console;
910 t_frame = Vterminal_frame; 899 t_frame = Vterminal_frame;
911 t_device = Vterminal_device; 900 t_device = Vterminal_device;
912 901
960 949
961 cur_offset = 256; 950 cur_offset = 256;
962 max_size = 0; 951 max_size = 0;
963 952
964 pdump_scan_by_alignment (pdump_allocate_offset); 953 pdump_scan_by_alignment (pdump_allocate_offset);
965 pdump_qnil = pdump_get_entry (XRECORD_LHEADER (Qnil));
966 954
967 pdump_buf = xmalloc (max_size); 955 pdump_buf = xmalloc (max_size);
968 /* Avoid use of the `open' macro. We want the real function. */ 956 /* Avoid use of the `open' macro. We want the real function. */
969 #undef open 957 #undef open
970 pdump_fd = open (EMACS_PROGNAME ".dmp", 958 pdump_fd = open (EMACS_PROGNAME ".dmp",
1236 #endif 1224 #endif
1237 1225
1238 pdump_mallocadr = xmalloc(pdump_length+255); 1226 pdump_mallocadr = xmalloc(pdump_length+255);
1239 pdump_free = pdump_file_free; 1227 pdump_free = pdump_file_free;
1240 pdump_start = (char *)((255 + (unsigned long)pdump_mallocadr) & ~255); 1228 pdump_start = (char *)((255 + (unsigned long)pdump_mallocadr) & ~255);
1241 read (pdump_fd, pdump_start, pdump_length); 1229 read (fd, pdump_start, pdump_length);
1242 1230
1243 close (pdump_fd); 1231 close (fd);
1244 return 1; 1232 return 1;
1245 } 1233 }
1246 #endif /* !WIN32_NATIVE */ 1234 #endif /* !WIN32_NATIVE */
1247 1235
1248 1236