Changeset 1673

Show
Ignore:
Timestamp:
02/17/98 01:45:18 (11 years ago)
Author:
himi
Message:

Meadow--Multilingual Enhancement to GNU Emacs with ADvantages Over Windows

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/GNU/src/unexhp9k800.c

    r1669 r1673  
    3838*/ 
    3939  
     40#include <stdio.h> 
     41#include <fcntl.h> 
     42#include <errno.h> 
     43 
     44#include <a.out.h> 
     45 
    4046#ifdef emacs 
    4147#include <config.h> 
    4248#endif 
    43  
    44 #include <stdio.h> 
    45 #include <fcntl.h> 
    46 #include <errno.h> 
    47  
    48 #include <a.out.h> 
    4949 
    5050#ifdef HPUX_USE_SHLIBS 
  • branches/GNU/src/unexsgi.c

    r1663 r1673  
    413413 */ 
    414414  
    415 #include <config.h> 
    416415#include <sys/types.h> 
    417416#include <stdio.h> 
     
    760759        } 
    761760      else 
    762         { 
    763           memcpy (&NEW_SECTION_H (nn), &OLD_SECTION_H (n),  
    764                   old_file_h->e_shentsize); 
    765  
    766           /* Any section that was original placed AFTER the bss 
    767              section must now be adjusted by NEW_OFFSETS_SHIFT.  */ 
    768  
    769           if (NEW_SECTION_H (nn).sh_offset >= new_data2_offset) 
    770             NEW_SECTION_H (nn).sh_offset += new_offsets_shift; 
    771         } 
    772  
     761        memcpy (&NEW_SECTION_H (nn), &OLD_SECTION_H (n),  
     762                old_file_h->e_shentsize); 
     763 
     764      /* Any section that was original placed AFTER the bss 
     765         section must now be adjusted by NEW_OFFSETS_SHIFT.  */ 
     766 
     767      if (NEW_SECTION_H (nn).sh_offset >= new_data2_offset) 
     768        NEW_SECTION_H (nn).sh_offset += new_offsets_shift; 
     769       
    773770      /* If any section hdr refers to the section after the new .data 
    774771         section, make it refer to next one because we have inserted  
     
    790787         ".data" in the strings table) get copied from the current process 
    791788         instead of the old file.  */ 
    792       if (!strcmp (old_section_names + NEW_SECTION_H (nn).sh_name, ".data") 
    793           || !strcmp (old_section_names + NEW_SECTION_H (nn).sh_name, ".data1") 
    794 #ifdef IRIX6_5 
    795           /* Under IRIX 6.5 gcc places objects with adresses relative to  
    796              shared symbols in the section .rodata, which are adjusted at 
    797              startup time. Unfortunately they aren't adjusted after unexec, 
    798              so with this configuration we must get .rodata also from memory.  
    799              Do any other configurations need this, too? 
    800              <Wolfgang.Glas@hfm.tu-graz.ac.at> 1999-06-08.  */ 
    801           || !strcmp (old_section_names + NEW_SECTION_H (nn).sh_name, ".rodata") 
    802 #endif 
    803           || !strcmp (old_section_names + NEW_SECTION_H (nn).sh_name, ".got")) 
     789      if (!strcmp (old_section_names + NEW_SECTION_H (n).sh_name, ".data") 
     790          || !strcmp (old_section_names + NEW_SECTION_H (n).sh_name, ".data1") 
     791          || !strcmp (old_section_names + NEW_SECTION_H (n).sh_name, ".got")) 
    804792        src = (caddr_t) OLD_SECTION_H (n).sh_addr; 
    805793      else 
     
    872860          for (; num--; sym++) 
    873861            { 
    874               /* don't patch special section indices. */ 
    875862              if (sym->st_shndx == SHN_UNDEF 
    876                   || sym->st_shndx >= SHN_LORESERVE) 
     863                  || sym->st_shndx == SHN_ABS 
     864                  || sym->st_shndx == SHN_COMMON) 
    877865                continue; 
    878866         
  • branches/GNU/src/unexsni.c

    r1669 r1673  
    2323You are forbidden to forbid anyone else to use, share and improve 
    2424what you give them.   Help stamp out software-hoarding!  */ 
     25 
    2526 
    2627/* 
     
    117118 * New modifications for Siemens Nixdorf's MIPS-based machines. 
    118119 * Marco.Walther@mch.sni.de 
    119  * marco@inreach.com 
    120120 * 
    121121 * The problem: Before the bss segment we have a so called sbss segment 
     
    306306#include <elf.h> 
    307307#include <sys/mman.h> 
    308 #include <assert.h> 
    309  
    310 /* #define DEBUG */ 
    311308 
    312309#ifndef emacs 
     
    387384  Elf32_Addr new_data3_addr; 
    388385 
    389  
    390   Elf32_Addr old_rel_dyn_addr; 
    391   Elf32_Word old_rel_dyn_size; 
    392   int old_rel_dyn_index; 
    393  
    394386  Elf32_Word old_sdata_size, new_sdata_size; 
    395387  int old_sdata_index = 0; 
     
    471463  if (old_sbss_index != (old_bss_index - 1)) 
    472464    fatal (".sbss should come immediately before .bss in %s.\n", old_name, 0); 
    473  
    474   /* Find the old .rel.dyn section. 
    475    */ 
    476  
    477   for (old_rel_dyn_index = 1; old_rel_dyn_index < old_file_h->e_shnum; 
    478        old_rel_dyn_index++) 
    479     { 
    480 #ifdef DEBUG 
    481       fprintf (stderr, "Looking for .rel.dyn - found %s\n", 
    482                old_section_names + OLD_SECTION_H(old_rel_dyn_index).sh_name); 
    483 #endif 
    484       if (!strcmp (old_section_names + OLD_SECTION_H(old_rel_dyn_index).sh_name, 
    485                    ".rel.dyn")) 
    486         break; 
    487     } 
    488   if (old_rel_dyn_index == old_file_h->e_shnum) 
    489     fatal ("Can't find .rel_dyn in %s.\n", old_name, 0); 
    490  
    491   old_rel_dyn_addr = OLD_SECTION_H(old_rel_dyn_index).sh_addr; 
    492   old_rel_dyn_size = OLD_SECTION_H(old_rel_dyn_index).sh_size; 
    493465 
    494466  /* Figure out parameters of the new data3 and data2 sections. 
     
    545517  fprintf (stderr, "old_sbss_addr %x\n", old_sbss_addr); 
    546518  fprintf (stderr, "old_sbss_size %x\n", old_sbss_size); 
    547   fprintf (stderr, "old_rel_dyn_addr %x\n", old_rel_dyn_addr); 
    548   fprintf (stderr, "old_rel_dyn_size %x\n", old_rel_dyn_size); 
    549519  if (old_sdata_index) 
    550520    { 
     
    847817        } 
    848818    } 
    849   { 
    850     Elf32_Rel *rel_p; 
    851     unsigned int old_data_addr_start; 
    852     unsigned int old_data_addr_end; 
    853     unsigned int old_data_offset; 
    854     unsigned int new_data_offset; 
    855     int i; 
    856  
    857     rel_p = (Elf32_Rel *)OLD_SECTION_H(old_rel_dyn_index).sh_addr; 
    858     old_data_addr_start = OLD_SECTION_H(old_data_index).sh_addr; 
    859     old_data_addr_end = old_data_addr_start + 
    860       OLD_SECTION_H(old_data_index).sh_size; 
    861     old_data_offset = (int)OLD_SECTION_H(old_data_index).sh_offset + 
    862       (unsigned int)old_base; 
    863     new_data_offset = (int)NEW_SECTION_H(old_data_index).sh_offset + 
    864       (unsigned int)new_base; 
    865  
    866 #ifdef DEBUG 
    867     fprintf(stderr, "old_data.sh_addr= 0x%08x ... 0x%08x\n", old_data_addr_start, 
    868             old_data_addr_end); 
    869 #endif /* DEBUG */ 
    870  
    871     for (i = 0; i < old_rel_dyn_size/sizeof(Elf32_Rel); i++) 
    872       { 
    873 #ifdef DEBUG 
    874         fprintf(stderr, ".rel.dyn offset= 0x%08x  type= %d  sym= %d\n", 
    875                 rel_p->r_offset, ELF32_R_TYPE(rel_p->r_info), ELF32_R_SYM(rel_p->r_info)); 
    876 #endif /* DEBUG */ 
    877  
    878         if (rel_p->r_offset) 
    879           { 
    880             unsigned int offset; 
    881  
    882             assert(old_data_addr_start <= rel_p->r_offset && 
    883                    rel_p->r_offset <= old_data_addr_end); 
    884  
    885             offset = rel_p->r_offset - old_data_addr_start; 
    886  
    887 #ifdef DEBUG 
    888             fprintf(stderr, "r_offset= 0x%08x  *r_offset= 0x%08x\n", 
    889                     rel_p->r_offset, *((int *)(rel_p->r_offset))); 
    890             fprintf(stderr, "old     = 0x%08x  *old     =0x%08x\n", 
    891                     (old_data_offset + offset - (unsigned int)old_base), 
    892                     *((int *)(old_data_offset + offset))); 
    893             fprintf(stderr, "new     = 0x%08x  *new     =0x%08x\n", 
    894                     (new_data_offset + offset - (unsigned int)new_base), 
    895                     *((int *)(new_data_offset + offset))); 
    896 #endif /* DEBUG */ 
    897  
    898             *((int *)(new_data_offset + offset)) = *((int *)(old_data_offset + offset)); 
    899           } 
    900  
    901         rel_p++; 
    902       } 
    903   } 
    904819 
    905820  /* Close the files and make the new file executable */ 
  • branches/GNU/src/unexsunos4.c

    r1669 r1673  
    11/* Unexec for Sunos 4 using shared libraries. 
    2    Copyright (C) 1990, 1994, 1999 Free Software Foundation, Inc. 
     2   Copyright (C) 1990, 1994 Free Software Foundation, Inc. 
    33 
    44This file is part of GNU Emacs. 
     
    4444 * 
    4545 */ 
    46  
    47 #ifdef emacs 
    48 #include <config.h> 
    49 #endif 
    50  
    5146#include <sys/param.h> 
    5247#include <sys/mman.h> 
     
    5651#include <stdio.h> 
    5752#include <a.out.h> 
     53 
     54/* Do this after the above #include's in case a configuration file wants 
     55   to define things for this file based on what <a.out.h> defines.  */ 
     56#ifdef emacs 
     57#include <config.h> 
     58#endif 
    5859 
    5960#if defined (SUNOS4) || defined (__FreeBSD__) || defined (__NetBSD__) 
  • branches/GNU/src/unexw32.c

    r1671 r1673  
    2222*/ 
    2323 
    24 #include <config.h> 
    25  
    2624#include <stdlib.h>     /* _fmode */ 
    2725#include <stdio.h> 
    2826#include <fcntl.h> 
    29 #include <time.h> 
    3027#include <windows.h> 
    3128 
    32 /* Include relevant definitions from IMAGEHLP.H, which can be found 
    33    in \\win32sdk\mstools\samples\image\include\imagehlp.h. */ 
    34  
    35 PIMAGE_NT_HEADERS 
    36 (__stdcall * pfnCheckSumMappedFile) (LPVOID BaseAddress, 
    37                                     DWORD FileLength, 
    38                                     LPDWORD HeaderSum, 
    39                                     LPDWORD CheckSum); 
    40  
     29#pragma data_seg(".emdata") 
    4130extern BOOL ctrl_c_handler (unsigned long type); 
    4231 
    43 extern char my_begdata[]; 
    44 extern char my_edata[]; 
    45 extern char my_begbss[]; 
    46 extern char my_endbss[]; 
    47 extern char *my_begbss_static; 
    48 extern char *my_endbss_static; 
    49  
    5032#include "w32heap.h" 
    51  
    52 #undef min 
    53 #undef max 
    54 #define min(x, y) (((x) < (y)) ? (x) : (y)) 
    55 #define max(x, y) (((x) > (y)) ? (x) : (y)) 
    5633 
    5734/* Basically, our "initialized" flag.  */ 
     
    7855DWORD  bss_size = 0; 
    7956 
    80 #ifdef HAVE_NTGUI 
    8157HINSTANCE hinst = NULL; 
    8258HINSTANCE hprevinst = NULL; 
    8359LPSTR lpCmdLine = ""; 
    8460int nCmdShow = 0; 
    85 #endif /* HAVE_NTGUI */ 
    8661 
    8762/* Startup code for running on NT.  When we are running as the dumped 
     
    9267_start (void) 
    9368{ 
     69#ifndef __BORLANDC__ /* 97/01/13 by Y.Matsushima */ 
    9470  extern void mainCRTStartup (void); 
     71  extern BOOL dump_memmap(void); 
     72#endif 
    9573 
    9674#if 0 
     
    131109          p[1] = 'e'; 
    132110      } 
    133  
     111#ifdef PROFILE 
    134112      /* Using HiProf profiler, exe name is different still. */ 
    135113      { 
     
    138116      } 
    139117#endif 
     118#endif 
    140119 
    141120      recreate_heap (executable_path); 
     
    158137  /* Invoke the NT CRT startup routine now that our housecleaning 
    159138     is finished.  */ 
    160 #ifdef HAVE_NTGUI 
    161139  /* determine WinMain args like crt0.c does */ 
    162140  hinst = GetModuleHandle(NULL); 
    163141  lpCmdLine = GetCommandLine(); 
    164142  nCmdShow = SW_SHOWDEFAULT; 
    165 #endif 
     143   
     144/*********************************************Check! Later!!!!! 
     145  init_allocate_heap(); 
     146**************************************************************/ 
     147#ifndef __BORLANDC__ /* 97/01/13 by Y.Matsushima */ 
    166148  mainCRTStartup (); 
    167 
     149#endif 
     150
     151 
     152#ifdef __BORLANDC__ /* 97/01/13 by Y.Matsushima */ 
     153#pragma startup _start 0 
     154BOOL BorlandDebugDump = FALSE; 
     155#endif 
    168156 
    169157/* Dump out .data and .bss sections into a new executable.  */ 
     
    206194  get_section_info (&in_file); 
    207195 
     196#ifndef __BORLANDC__ /* 97/01/17 by Y.Matsushima */ 
    208197  /* The size of the dumped executable is the size of the original 
    209198     executable plus the size of the heap and the size of the .bss section.  */ 
     
    223212  copy_executable_and_dump_data_section (&in_file, &out_file); 
    224213  dump_bss_and_heap (&in_file, &out_file); 
    225  
    226   /* Patch up header fields; profiler is picky about this. */ 
    227   { 
    228     PIMAGE_DOS_HEADER dos_header; 
    229     PIMAGE_NT_HEADERS nt_header; 
    230     HANDLE hImagehelp = LoadLibrary ("imagehlp.dll"); 
    231     DWORD  headersum; 
    232     DWORD  checksum; 
    233  
    234     dos_header = (PIMAGE_DOS_HEADER) out_file.file_base; 
    235     nt_header = (PIMAGE_NT_HEADERS) ((char *) dos_header + dos_header->e_lfanew); 
    236  
    237     nt_header->OptionalHeader.CheckSum = 0; 
    238 //    nt_header->FileHeader.TimeDateStamp = time (NULL); 
    239 //    dos_header->e_cp = size / 512; 
    240 //    nt_header->OptionalHeader.SizeOfImage = size; 
    241  
    242     pfnCheckSumMappedFile = (void *) GetProcAddress (hImagehelp, "CheckSumMappedFile"); 
    243     if (pfnCheckSumMappedFile) 
    244       { 
    245 //      nt_header->FileHeader.TimeDateStamp = time (NULL); 
    246         pfnCheckSumMappedFile (out_file.file_base, 
    247                                out_file.size, 
    248                                &headersum, 
    249                                &checksum); 
    250         nt_header->OptionalHeader.CheckSum = checksum; 
    251       } 
    252     FreeLibrary (hImagehelp); 
     214#else 
     215  if( !BorlandDebugDump ){ 
     216      heap_index_in_executable = (unsigned long) 
     217        round_to_next ((unsigned char *) in_file.size, get_allocation_unit ()); 
     218      size = heap_index_in_executable + get_committed_heap_size () + bss_size; 
     219  } else { 
     220      heap_index_in_executable = 0; 
     221      size = in_file.size; 
    253222  } 
    254  
     223  open_output_file (&out_file, out_filename, size); 
     224  need_to_recreate_heap = TRUE; 
     225  copy_executable_and_dump_data_section (&in_file, &out_file); 
     226  if( BorlandDebugDump ){ 
     227      close_file_data (&out_file); 
     228      size = get_committed_heap_size () + bss_size; 
     229      strcpy(&out_filename[strlen(out_filename) -4], ".dmp"); 
     230      open_output_file(&out_file, out_filename, size); 
     231  } 
     232  dump_bss_and_heap (&in_file, &out_file); 
     233#endif 
    255234  close_file_data (&in_file); 
    256235  close_file_data (&out_file); 
     
    334313 
    335314/* Routines to manipulate NT executable file sections.  */ 
    336  
    337 #ifdef SEPARATE_BSS_SECTION 
     315#if 0 
    338316static void 
    339317get_bss_info_from_map_file (file_data *p_infile, PUCHAR *p_bss_start,  
     
    376354#endif 
    377355 
    378 unsigned long 
     356/* Correct section size is not necessary. The wanted size has only not to 
     357   not collide with other sections. */ 
     358#if 0 
     359static unsigned long 
    379360get_section_size (PIMAGE_SECTION_HEADER p_section) 
    380361{ 
    381   /* The true section size, before rounding.  Some linkers swap the 
    382      meaning of these two values.  */ 
    383   return min (p_section->SizeOfRawData, 
    384               p_section->Misc.VirtualSize); 
    385 
    386  
     362  /* The section size is in different locations in the different versions.  */ 
     363  switch (get_nt_minor_version ())  
     364    { 
     365    case 10: 
     366      return p_section->SizeOfRawData; 
     367    default: 
     368      return p_section->Misc.VirtualSize; 
     369    } 
     370
     371#endif 
    387372/* Return pointer to section header for named section. */ 
    388373IMAGE_SECTION_HEADER * 
     
    422407  return NULL; 
    423408} 
    424  
    425409 
    426410/* Flip through the executable and cache the info necessary for dumping.  */ 
     
    434418  int i; 
    435419   
     420#ifndef __BORLANDC__ /* 97/01/13 by Y.Matsushima */ 
     421  const char *SectionNameData = ".emdata"; 
     422  const char *SectionNameBss  = ".embss"; 
     423#else 
     424  const char *SectionNameData = "DATA"; 
     425  const char *SectionNameBss  = "BSS--> UnUsed"; 
     426  const char *SectionNameDebug= ".debug"; 
     427  extern char my_sdata, my_sbss; 
     428  extern char my_edata, my_ebss; 
     429#endif 
     430 
    436431  dos_header = (PIMAGE_DOS_HEADER) p_infile->file_base; 
    437432  if (dos_header->e_magic != IMAGE_DOS_SIGNATURE)  
     
    460455  for (i = 0; i < nt_header->FileHeader.NumberOfSections; i++)  
    461456    { 
    462 #ifdef SEPARATE_BSS_SECTION 
    463       if (!strcmp (section->Name, ".bss"))  
     457      if (!strcmp (section->Name, SectionNameBss))  
    464458        { 
    465           /* The .bss section.  */ 
     459          /* The .embss section.  */ 
    466460          ptr = (char *) nt_header->OptionalHeader.ImageBase + 
    467461            section->VirtualAddress; 
    468462          bss_start = ptr; 
     463#if 0 
    469464          bss_size = get_section_size (section); 
     465#else 
     466          bss_size = section->Misc.VirtualSize; 
     467#endif 
    470468        } 
    471 #endif 
    472 #if 0 
    473       if (!strcmp (section->Name, ".data"))  
     469      if (!strcmp (section->Name, SectionNameData)) 
    474470        { 
    475           /* From lastfile.c  */ 
    476           extern char my_edata[]; 
    477  
    478471          /* The .data section.  */ 
    479472          data_section = section; 
    480473          ptr = (char *) nt_header->OptionalHeader.ImageBase + 
    481474            section->VirtualAddress; 
     475#ifndef __BORLANDC__ /* 97/01/13 by Y.Matsushima */ 
    482476          data_start_va = ptr; 
    483477          data_start_file = section->PointerToRawData; 
    484478 
     479#if 0 
    485480          /* We want to only write Emacs data back to the executable, 
    486481             not any of the library data (if library data is included, 
     
    488483             than the one Emacs was dumped on).  */ 
    489484          data_size = my_edata - data_start_va; 
     485#endif 
     486          data_size = section -> SizeOfRawData; 
     487#else /* for BORLANDC */ 
     488          /* INIT DATA */ 
     489          data_start_file = section->PointerToRawData + 
     490            ((DWORD)&my_sdata - (DWORD)ptr); /* seek to &my_sdata */ 
     491          data_start_va = &my_sdata; 
     492          data_size = (DWORD)&my_edata - (DWORD)&my_sdata; 
     493          /* BSS */ 
     494          bss_start = &my_sbss; 
     495          bss_size  = (DWORD)&my_ebss - (DWORD)&my_sbss; 
     496#endif 
    490497        } 
    491 #else 
    492       if (!strcmp (section->Name, "EMDATA"))  
    493         { 
    494           /* The Emacs initialized data section.  */ 
    495           data_section = section; 
    496           ptr = (char *) nt_header->OptionalHeader.ImageBase + 
    497             section->VirtualAddress; 
    498           data_start_va = ptr; 
    499           data_start_file = section->PointerToRawData; 
    500  
    501           /* Write back the full section.  */ 
    502           data_size = get_section_size (section); 
    503         } 
     498#ifdef __BORLANDC__ /* 97/01/17 by Y.Matsushima */ 
     499      if( !strcmp (section->Name, SectionNameDebug) ) 
     500          BorlandDebugDump = TRUE; 
    504501#endif 
    505502      section++; 
    506503    } 
    507504 
    508 #ifdef SEPARATE_BSS_SECTION 
    509   if (bss_start == UNINIT_PTR && bss_size == UNINIT_LONG
     505#if 0 
     506  if (!bss_start && !bss_size
    510507    { 
    511508      /* Starting with MSVC 4.0, the .bss section has been eliminated 
     
    521518        + data_section->VirtualAddress; 
    522519    } 
    523 #else 
    524 /* As noted in lastfile.c, the Alpha (but not the Intel) MSVC linker 
    525    globally segregates all static and public bss data (ie. across all 
    526    linked modules, not just per module), so we must take both static and 
    527    public bss areas into account to determine the true extent of the bss 
    528    area used by Emacs. 
    529  
    530    To be strictly correct, we should dump the static and public bss 
    531    areas used by Emacs separately if non-overlapping (since otherwise we 
    532    are dumping bss data belonging to system libraries, eg. the static 
    533    bss system data on the Alpha).  However, in practice this doesn't 
    534    seem to matter, since presumably the system libraries always 
    535    reinitialize their bss variables.  */ 
    536   bss_start = min (my_begbss, my_begbss_static); 
    537   bss_size = max (my_endbss, my_endbss_static) - bss_start; 
    538520#endif 
    539521} 
     
    548530  unsigned char *data_file, *data_va; 
    549531  unsigned long size, index; 
    550    
     532  
    551533  /* Get a pointer to where the raw data should go in the executable file.  */ 
    552534  data_file = (char *) p_outfile->file_base + data_start_file; 
     
    563545   
    564546  size = data_size; 
    565   printf ("Dumping .data section...\n"); 
     547  printf ("Dumping .emdata section...\n"); 
    566548  printf ("\t0x%08x Address in process.\n", data_va); 
    567549  printf ("\t0x%08x Offset in output file.\n",  
     
    598580    memcpy ((PUCHAR) p_outfile->file_base + index, heap_data, size); 
    599581 
    600     printf ("Dumping .bss into executable...\n"); 
     582/* .embss section is dumped for all uninitialized data. */ 
     583    printf ("Dumping .embss into executable...\n"); 
    601584     
    602585    index += size; 
     
    604587    bss_data = bss_start; 
    605588     
    606     printf ("\t0x%08x BSS start in process.\n", bss_data); 
    607     printf ("\t0x%08x BSS offset in executable.\n", index); 
    608     printf ("\t0x%08x BSS size in bytes.\n", size); 
     589    printf ("\t0x%08x EMACS BSS start in process.\n", bss_data); 
     590    printf ("\t0x%08x EMACS BSS offset in executable.\n", index); 
     591    printf ("\t0x%08x EMACS BSS size in bytes.\n", size); 
    609592    memcpy ((char *) p_outfile->file_base + index, bss_data, size); 
    610593} 
     
    613596/* Reload and remap routines.  */ 
    614597 
    615 void 
    616 w32_fatal_reload_error (char *step) 
    617 { 
    618   int error = GetLastError (); 
    619   char *buffer = alloca (4096); 
    620  
    621   sprintf (buffer,  
    622            "Emacs failed to load its dumped heap back into its address space.\n" 
    623            "The error occurred during the following step:\n\n" 
    624            "%s\n\n" 
    625            "GetLastError = %d\n\n" 
    626            "Heap start:  0x%08x\n" 
    627            "Heap commit:  0x%08x\n" 
    628            "Heap end:  0x%08x\n\n" 
    629            "This error typically happens when the system loads a DLL into\n" 
    630            "the middle of Emacs' address space, preventing Emacs from\n" 
    631            "loading its heap there.  If this happens only occasionally, then\n" 
    632            "you can probably ignore it.  But if it happens so often that\n" 
    633            "you cannot get Emacs to start reliably, and you think that Emacs\n" 
    634            "is installed correctly, then you have a couple of options:\n\n" 
    635            "Emacs correctly, then you have two options:\n\n" 
    636            "1) You can dump Emacs yourself.  By doing this, you ensure that\n" 
    637            "Emacs' heap fits around the DLLs in your system.  To dump Emacs,\n" 
    638            "download the emacs-(version)-undump-(arch) distribution file\n" 
    639            "from the site where you downloaded the executable distribution.\n\n" 
    640            "2) You can build Emacs from source.  This is just another way\n" 
    641            "to dump Emacs on your system.", 
    642            step,  
    643            error, 
    644            get_heap_start (),  
    645            get_heap_start () + get_committed_heap_size (), 
    646            get_heap_end ()); 
    647  
    648   MessageBox (NULL, 
    649               buffer, 
    650               "Emacs Abort Dialog", 
    651               MB_OK | MB_ICONEXCLAMATION | MB_TASKMODAL); 
    652  
    653   exit (-1); 
    654 } 
    655598 
    656599/* Load the dumped .bss section into the .bss area of our address space.  */ 
     
    662605  char   buffer[512], *bss; 
    663606  int    i; 
    664  
     607#ifdef __BORLANDC__ /* 97/01/17 by Y.Matsushima */ 
     608  char alter_filename[MAX_PATH]; 
     609 
     610  if( BorlandDebugDump ){ 
     611      strcpy(alter_filename, filename); 
     612      strcpy(&alter_filename[strlen(alter_filename) -4], ".dmp"); 
     613      filename = alter_filename; 
     614  } 
     615#endif 
    665616  file = CreateFile (filename, GENERIC_READ, FILE_SHARE_READ, NULL, 
    666617                     OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); 
    667618  if (file == INVALID_HANDLE_VALUE)  
    668     w32_fatal_reload_error ("Opening Emacs executable file for .bss."); 
     619    { 
     620      i = GetLastError (); 
     621      exit (1); 
     622    } 
    669623 
    670624  /* Seek to where the .bss section is tucked away after the heap...  */ 
    671625  index = heap_index_in_executable + get_committed_heap_size (); 
    672626  if (SetFilePointer (file, index, NULL, FILE_BEGIN) == 0xFFFFFFFF)  
    673     w32_fatal_reload_error ("Seeking to the saved .bss section."); 
     627    { 
     628      i = GetLastError (); 
     629      exit (1); 
     630    } 
     631 
    674632   
    675633  /* Ok, read in the saved .bss section and initialize all  
    676634     uninitialized variables.  */ 
    677635  if (!ReadFile (file, bss_start, bss_size, &n_read, NULL)) 
    678     w32_fatal_reload_error ("Reading the saved .bss section."); 
     636    { 
     637      i = GetLastError (); 
     638      exit (1); 
     639    } 
    679640 
    680641  CloseHandle (file); 
     
    690651  unsigned long size, upper_size, n_read; 
    691652  int    i; 
    692  
     653#ifdef __BORLANDC__ /* 97/01/17 by Y.Matsushima */ 
     654  char alter_filename[MAX_PATH]; 
     655 
     656  if( BorlandDebugDump ){ 
     657      strcpy(alter_filename, filename); 
     658      strcpy(&alter_filename[strlen(alter_filename) -4], ".dmp"); 
     659      filename = alter_filename; 
     660  } 
     661#endif 
    693662  file = CreateFile (filename, GENERIC_READ, FILE_SHARE_READ, NULL, 
    694663                     OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); 
    695664  if (file == INVALID_HANDLE_VALUE)  
    696     w32_fatal_reload_error ("Opening Emacs executable file for heap."); 
     665    { 
     666      i = GetLastError (); 
     667      exit (1); 
     668    } 
    697669   
    698670  size = GetFileSize (file, &upper_size); 
     
    700672                                    0, size, NULL); 
    701673  if (!file_mapping)  
    702     w32_fatal_reload_error ("Creating file mapping to heap in executable."); 
     674    { 
     675      i = GetLastError (); 
     676      exit (1); 
     677    } 
    703678     
    704679  size = get_committed_heap_size (); 
     
    718693  if (VirtualAlloc (get_heap_start (), get_committed_heap_size (), 
    719694                    MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE) == NULL) 
    720     w32_fatal_reload_error ("Allocating heap address space."); 
     695    { 
     696      i = GetLastError (); 
     697      exit (1); 
     698    } 
    721699 
    722700  /* Seek to the location of the heap data in the executable.  */ 
    723701  i = heap_index_in_executable; 
    724702  if (SetFilePointer (file, i, NULL, FILE_BEGIN) == 0xFFFFFFFF) 
    725     w32_fatal_reload_error ("Seeking to saved heap in executable file."); 
     703    { 
     704      i = GetLastError (); 
     705      exit (1); 
     706    } 
    726707 
    727708  /* Read in the data.  */ 
    728709  if (!ReadFile (file, get_heap_start (),  
    729710                 get_committed_heap_size (), &n_read, NULL)) 
    730     w32_fatal_reload_error ("Reading saved heap from executable file."); 
     711    { 
     712      i = GetLastError (); 
     713      exit (1); 
     714    } 
    731715 
    732716  CloseHandle (file); 
  • branches/GNU/src/vm-limit.c

    r1667 r1673  
    131131  warn_function = warnfun; 
    132132  __after_morecore_hook = check_memory_limits; 
    133  
    134 #ifdef WINDOWSNT 
    135   /* Force data limit to be recalculated on each run.  */ 
    136   lim_data = 0; 
    137 #endif 
    138133}