#include "sysfile.h"
#include "console-stream.h"
#include "dumper.h"
+#include "sysdep.h"
#ifdef WIN32_NATIVE
#include "nt.h"
static void *pdump_buf;
static FILE *pdump_out;
+#ifdef UTF2000
+#define PDUMP_HASHSIZE 20000001
+#else
#define PDUMP_HASHSIZE 200001
+#endif
static pdump_entry_list_elt **pdump_hash;
else
{
stderr_out (" - %s (%d, %d)\n",
- LHEADER_IMPLEMENTATION (backtrace[i].obj)->name,
- backtrace[i].position,
- backtrace[i].offset);
+ LHEADER_IMPLEMENTATION (backtrace[i].obj)->name,
+ backtrace[i].position,
+ backtrace[i].offset);
}
}
}
const struct lrecord_description *idesc,
const void *idata)
{
- EMACS_INT count;
+ EMACS_INT count = 0; /* initialize to shut up GCC */
const void *irdata;
int line = XD_INDIRECT_VAL (code);
stderr_out ("Unsupported count type : %d (line = %d, code=%ld)\n",
idesc[line].type, line, (long)code);
pdump_backtrace ();
- abort ();
+ ABORT ();
}
count += delta;
return count;
default:
stderr_out ("Unsupported dump type : %d\n", desc[pos].type);
pdump_backtrace ();
- abort ();
+ ABORT ();
};
}
}
if (imp->description)
{
int me = depth++;
- if (me>65536)
+ if (me>=65536)
{
stderr_out ("Backtrace overflow, loop ?\n");
- abort ();
+ ABORT ();
}
backtrace[me].obj = objh;
backtrace[me].position = 0;
{
int me = depth++;
int i;
- if (me>65536)
+ if (me>=65536)
{
stderr_out ("Backtrace overflow, loop ?\n");
- abort ();
+ ABORT ();
}
backtrace[me].obj = 0;
backtrace[me].position = 0;
}
default:
stderr_out ("Unsupported dump type : %d\n", desc[pos].type);
- abort ();
+ ABORT ();
}
}
}
}
default:
stderr_out ("Unsupported dump type : %d\n", desc[pos].type);
- abort ();
+ ABORT ();
};
}
}
for (align = ALIGNOF (max_align_t); align; align>>=1)
{
- int i;
+ size_t i;
pdump_entry_list_elt *elt;
for (i=0; i<lrecord_type_count; i++)
static void
pdump_dump_root_struct_ptrs (void)
{
- int i;
+ size_t i;
size_t count = Dynarr_length (pdump_root_struct_ptrs);
pdump_static_pointer *data = alloca_array (pdump_static_pointer, count);
for (i = 0; i < count; i++)
static void
pdump_dump_rtables (void)
{
- int i;
+ size_t i;
pdump_entry_list_elt *elt;
pdump_reloc_table rt;
{
size_t count = (Dynarr_length (pdump_root_objects) +
Dynarr_length (pdump_weak_object_chains));
- size_t i;
+ EMACS_INT i;
PDUMP_WRITE_ALIGNED (size_t, count);
PDUMP_ALIGN_OUTPUT (pdump_static_Lisp_Object);
void
pdump (void)
{
- int i;
+ size_t i;
Lisp_Object t_console, t_device, t_frame;
int none;
pdump_header header;
t_frame = Vterminal_frame; Vterminal_frame = Qnil;
t_device = Vterminal_device; Vterminal_device = Qnil;
- dump_add_opaque (&lrecord_implementations_table,
+ dump_add_opaque ((void *) &lrecord_implementations_table,
lrecord_type_count * sizeof (lrecord_implementations_table[0]));
dump_add_opaque (&lrecord_markers,
lrecord_type_count * sizeof (lrecord_markers[0]));
if (!none)
return;
- for (i=0; i<Dynarr_length (pdump_root_struct_ptrs); i++)
+ for (i=0; i<(size_t)Dynarr_length (pdump_root_struct_ptrs); i++)
{
pdump_root_struct_ptr info = Dynarr_at (pdump_root_struct_ptrs, i);
pdump_register_struct (*(info.ptraddress), info.desc, 1);
int
pdump_load (const char *argv0)
{
- char exe_path[PATH_MAX];
+ char exe_path[PATH_MAX], real_exe_path[PATH_MAX];
#ifdef WIN32_NATIVE
GetModuleFileName (NULL, exe_path, PATH_MAX);
+ /* #### urk, needed for xrealpath() below */
+ Vdirectory_sep_char = make_char ('\\');
#else /* !WIN32_NATIVE */
char *w;
const char *dir, *p;
}
strcpy (w, name);
- /* ### #$%$#^$^@%$^#%@$ ! */
-#ifdef access
-#undef access
-#endif
+ /* Check that exe_path is executable and not a directory */
+#undef access /* avoid !@#$%^& encapsulated access */
+#undef stat /* avoid !@#$%^& encapsulated stat */
+ {
+ struct stat statbuf;
+ if (access (exe_path, X_OK) == 0
+ && stat (exe_path, &statbuf) == 0
+ && ! S_ISDIR (statbuf.st_mode))
+ break;
+ }
- if (!access (exe_path, X_OK))
- break;
if (!*p)
{
/* Oh well, let's have some kind of default */
}
#endif /* WIN32_NATIVE */
- if (pdump_file_try (exe_path))
+ /* Save exe_path because pdump_file_try() modifies it */
+ strcpy(real_exe_path, exe_path);
+ if (pdump_file_try (exe_path)
+ || (xrealpath(real_exe_path, real_exe_path)
+ && pdump_file_try (real_exe_path)))
{
pdump_load_finish ();
return 1;