diff options
Diffstat (limited to 'src/pdumper.c')
-rw-r--r-- | src/pdumper.c | 53 |
1 files changed, 27 insertions, 26 deletions
diff --git a/src/pdumper.c b/src/pdumper.c index 7730ea3d061..9eff5c48d09 100644 --- a/src/pdumper.c +++ b/src/pdumper.c @@ -312,14 +312,15 @@ dump_reloc_set_offset (struct dump_reloc *reloc, dump_off offset) error ("dump relocation out of range"); } -static void -dump_fingerprint (char const *label, +void +dump_fingerprint (FILE *output, char const *label, unsigned char const xfingerprint[sizeof fingerprint]) { enum { hexbuf_size = 2 * sizeof fingerprint }; char hexbuf[hexbuf_size]; hexbuf_digest (hexbuf, xfingerprint, sizeof fingerprint); - fprintf (stderr, "%s: %.*s\n", label, hexbuf_size, hexbuf); + fprintf (output, "%s%s%.*s\n", label, *label ? ": " : "", + hexbuf_size, hexbuf); } /* To be used if some order in the relocation process has to be enforced. */ @@ -799,7 +800,7 @@ dump_tailq_length (const struct dump_tailq *tailq) return tailq->length; } -static void ATTRIBUTE_UNUSED +static void dump_tailq_prepend (struct dump_tailq *tailq, Lisp_Object value) { Lisp_Object link = Fcons (value, tailq->head); @@ -809,24 +810,6 @@ dump_tailq_prepend (struct dump_tailq *tailq, Lisp_Object value) tailq->length += 1; } -static void ATTRIBUTE_UNUSED -dump_tailq_append (struct dump_tailq *tailq, Lisp_Object value) -{ - Lisp_Object link = Fcons (value, Qnil); - if (NILP (tailq->head)) - { - eassert (NILP (tailq->tail)); - tailq->head = tailq->tail = link; - } - else - { - eassert (!NILP (tailq->tail)); - XSETCDR (tailq->tail, link); - tailq->tail = link; - } - tailq->length += 1; -} - static bool dump_tailq_empty_p (struct dump_tailq *tailq) { @@ -4145,7 +4128,7 @@ types. */) ctx->header.fingerprint[i] = fingerprint[i]; const dump_off header_start = ctx->offset; - dump_fingerprint ("Dumping fingerprint", ctx->header.fingerprint); + dump_fingerprint (stderr, "Dumping fingerprint", ctx->header.fingerprint); dump_write (ctx, &ctx->header, sizeof (ctx->header)); const dump_off header_end = ctx->offset; @@ -4537,15 +4520,28 @@ dump_map_file_w32 (void *base, int fd, off_t offset, size_t size, uint32_t offset_low = (uint32_t) (full_offset & 0xffffffff); int error; + DWORD protect; DWORD map_access; file = (HANDLE) _get_osfhandle (fd); if (file == INVALID_HANDLE_VALUE) goto out; + switch (protection) + { + case DUMP_MEMORY_ACCESS_READWRITE: + protect = PAGE_WRITECOPY; /* for Windows 9X */ + break; + default: + case DUMP_MEMORY_ACCESS_NONE: + case DUMP_MEMORY_ACCESS_READ: + protect = PAGE_READONLY; + break; + } + section = CreateFileMapping (file, /*lpAttributes=*/NULL, - PAGE_READONLY, + protect, /*dwMaximumSizeHigh=*/0, /*dwMaximumSizeLow=*/0, /*lpName=*/NULL); @@ -5300,6 +5296,9 @@ dump_do_dump_relocation (const uintptr_t dump_base, error ("Trying to load incoherent dumped eln file %s", SSDATA (comp_u->file)); + if (!CONSP (comp_u->file)) + error ("Incoherent compilation unit for dump was dumped"); + /* emacs_execdir is always unibyte, but the file names in comp_u->file could be multibyte, so we need to encode them. */ @@ -5601,8 +5600,8 @@ pdumper_load (const char *dump_filename, char *argv0) desired[i] = fingerprint[i]; if (memcmp (header->fingerprint, desired, sizeof desired) != 0) { - dump_fingerprint ("desired fingerprint", desired); - dump_fingerprint ("found fingerprint", header->fingerprint); + dump_fingerprint (stderr, "desired fingerprint", desired); + dump_fingerprint (stderr, "found fingerprint", header->fingerprint); goto out; } @@ -5710,6 +5709,7 @@ pdumper_load (const char *dump_filename, char *argv0) dump_mmap_release (§ions[i]); if (dump_fd >= 0) emacs_close (dump_fd); + return err; } @@ -5794,6 +5794,7 @@ syms_of_pdumper (void) DEFSYM (Qdumped_with_pdumper, "dumped-with-pdumper"); DEFSYM (Qload_time, "load-time"); DEFSYM (Qdump_file_name, "dump-file-name"); + DEFSYM (Qafter_pdump_load_hook, "after-pdump-load-hook"); defsubr (&Spdumper_stats); #endif /* HAVE_PDUMPER */ } |