diff options
| author | Andreas Schwab | 2021-10-12 10:47:33 +0200 |
|---|---|---|
| committer | Andreas Schwab | 2021-10-12 10:54:45 +0200 |
| commit | 0fe91bcfe2ba87be40050e214284a995a2a54900 (patch) | |
| tree | 63f519df22160ba6a61ad444235c90dbdbaa05cd | |
| parent | 7865bd6782dacf506de8f69064f018de444da27f (diff) | |
| download | emacs-0fe91bcfe2ba87be40050e214284a995a2a54900.tar.gz emacs-0fe91bcfe2ba87be40050e214284a995a2a54900.zip | |
Change --fingerprint to output to stdout
* src/pdumper.c (dump_fingerprint): Add argument OUTPUT, use it
instead of stderr, update all uses. Don't print colon if LABEL is
empty.
* src/pdumper.h (dump_fingerprint): Adjust.
* src/emacs.c (main): Print fingerprint to stdout, without label.
* Makefile.in (EMACS_PDMP): Adjust.
| -rw-r--r-- | Makefile.in | 2 | ||||
| -rw-r--r-- | src/emacs.c | 5 | ||||
| -rw-r--r-- | src/pdumper.c | 11 | ||||
| -rw-r--r-- | src/pdumper.h | 2 |
4 files changed, 11 insertions, 9 deletions
diff --git a/Makefile.in b/Makefile.in index c6c507fd42b..300340c6e82 100644 --- a/Makefile.in +++ b/Makefile.in | |||
| @@ -313,7 +313,7 @@ TRANSFORM = @program_transform_name@ | |||
| 313 | EMACS_NAME = `echo emacs | sed '$(TRANSFORM)'` | 313 | EMACS_NAME = `echo emacs | sed '$(TRANSFORM)'` |
| 314 | EMACS = ${EMACS_NAME}${EXEEXT} | 314 | EMACS = ${EMACS_NAME}${EXEEXT} |
| 315 | EMACSFULL = `echo emacs-${version} | sed '$(TRANSFORM)'`${EXEEXT} | 315 | EMACSFULL = `echo emacs-${version} | sed '$(TRANSFORM)'`${EXEEXT} |
| 316 | EMACS_PDMP = `./src/emacs${EXEEXT} --fingerprint 2>&1 | sed 's/.* //'`.pdmp | 316 | EMACS_PDMP = `./src/emacs${EXEEXT} --fingerprint`.pdmp |
| 317 | 317 | ||
| 318 | # Subdirectories to make recursively. | 318 | # Subdirectories to make recursively. |
| 319 | SUBDIR = $(NTDIR) lib lib-src src lisp | 319 | SUBDIR = $(NTDIR) lib lib-src src lisp |
diff --git a/src/emacs.c b/src/emacs.c index cda7a9bf77f..b178c6a06cf 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -933,7 +933,7 @@ load_pdump (int argc, char **argv) | |||
| 933 | copies and renames it. */ | 933 | copies and renames it. */ |
| 934 | hexbuf_size = 2 * sizeof fingerprint; | 934 | hexbuf_size = 2 * sizeof fingerprint; |
| 935 | hexbuf = xmalloc (hexbuf_size + 1); | 935 | hexbuf = xmalloc (hexbuf_size + 1); |
| 936 | hexbuf_digest (hexbuf, (char *)fingerprint, sizeof fingerprint); | 936 | hexbuf_digest (hexbuf, (char *) fingerprint, sizeof fingerprint); |
| 937 | hexbuf[hexbuf_size] = '\0'; | 937 | hexbuf[hexbuf_size] = '\0'; |
| 938 | needed = (strlen (path_exec) | 938 | needed = (strlen (path_exec) |
| 939 | + 1 | 939 | + 1 |
| @@ -1403,7 +1403,8 @@ main (int argc, char **argv) | |||
| 1403 | { | 1403 | { |
| 1404 | if (initialized) | 1404 | if (initialized) |
| 1405 | { | 1405 | { |
| 1406 | dump_fingerprint ("fingerprint", (unsigned char *)fingerprint); | 1406 | dump_fingerprint (stdout, "", |
| 1407 | (unsigned char *) fingerprint); | ||
| 1407 | exit (0); | 1408 | exit (0); |
| 1408 | } | 1409 | } |
| 1409 | else | 1410 | else |
diff --git a/src/pdumper.c b/src/pdumper.c index 977f4fb2a85..96fbd56a236 100644 --- a/src/pdumper.c +++ b/src/pdumper.c | |||
| @@ -313,13 +313,14 @@ dump_reloc_set_offset (struct dump_reloc *reloc, dump_off offset) | |||
| 313 | } | 313 | } |
| 314 | 314 | ||
| 315 | void | 315 | void |
| 316 | dump_fingerprint (char const *label, | 316 | dump_fingerprint (FILE *output, char const *label, |
| 317 | unsigned char const xfingerprint[sizeof fingerprint]) | 317 | unsigned char const xfingerprint[sizeof fingerprint]) |
| 318 | { | 318 | { |
| 319 | enum { hexbuf_size = 2 * sizeof fingerprint }; | 319 | enum { hexbuf_size = 2 * sizeof fingerprint }; |
| 320 | char hexbuf[hexbuf_size]; | 320 | char hexbuf[hexbuf_size]; |
| 321 | hexbuf_digest (hexbuf, xfingerprint, sizeof fingerprint); | 321 | hexbuf_digest (hexbuf, xfingerprint, sizeof fingerprint); |
| 322 | fprintf (stderr, "%s: %.*s\n", label, hexbuf_size, hexbuf); | 322 | fprintf (output, "%s%s%.*s\n", label, *label ? ": " : "", |
| 323 | hexbuf_size, hexbuf); | ||
| 323 | } | 324 | } |
| 324 | 325 | ||
| 325 | /* To be used if some order in the relocation process has to be enforced. */ | 326 | /* To be used if some order in the relocation process has to be enforced. */ |
| @@ -4127,7 +4128,7 @@ types. */) | |||
| 4127 | ctx->header.fingerprint[i] = fingerprint[i]; | 4128 | ctx->header.fingerprint[i] = fingerprint[i]; |
| 4128 | 4129 | ||
| 4129 | const dump_off header_start = ctx->offset; | 4130 | const dump_off header_start = ctx->offset; |
| 4130 | dump_fingerprint ("Dumping fingerprint", ctx->header.fingerprint); | 4131 | dump_fingerprint (stderr, "Dumping fingerprint", ctx->header.fingerprint); |
| 4131 | dump_write (ctx, &ctx->header, sizeof (ctx->header)); | 4132 | dump_write (ctx, &ctx->header, sizeof (ctx->header)); |
| 4132 | const dump_off header_end = ctx->offset; | 4133 | const dump_off header_end = ctx->offset; |
| 4133 | 4134 | ||
| @@ -5596,8 +5597,8 @@ pdumper_load (const char *dump_filename, char *argv0) | |||
| 5596 | desired[i] = fingerprint[i]; | 5597 | desired[i] = fingerprint[i]; |
| 5597 | if (memcmp (header->fingerprint, desired, sizeof desired) != 0) | 5598 | if (memcmp (header->fingerprint, desired, sizeof desired) != 0) |
| 5598 | { | 5599 | { |
| 5599 | dump_fingerprint ("desired fingerprint", desired); | 5600 | dump_fingerprint (stderr, "desired fingerprint", desired); |
| 5600 | dump_fingerprint ("found fingerprint", header->fingerprint); | 5601 | dump_fingerprint (stderr, "found fingerprint", header->fingerprint); |
| 5601 | goto out; | 5602 | goto out; |
| 5602 | } | 5603 | } |
| 5603 | 5604 | ||
diff --git a/src/pdumper.h b/src/pdumper.h index bc339c42da5..87de592b819 100644 --- a/src/pdumper.h +++ b/src/pdumper.h | |||
| @@ -50,7 +50,7 @@ enum { PDUMPER_NO_OBJECT = -1 }; | |||
| 50 | #define PDUMPER_REMEMBER_SCALAR(thing) \ | 50 | #define PDUMPER_REMEMBER_SCALAR(thing) \ |
| 51 | pdumper_remember_scalar (&(thing), sizeof (thing)) | 51 | pdumper_remember_scalar (&(thing), sizeof (thing)) |
| 52 | 52 | ||
| 53 | extern void dump_fingerprint (const char *label, | 53 | extern void dump_fingerprint (FILE *output, const char *label, |
| 54 | const unsigned char *xfingerprint); | 54 | const unsigned char *xfingerprint); |
| 55 | 55 | ||
| 56 | extern void pdumper_remember_scalar_impl (void *data, ptrdiff_t nbytes); | 56 | extern void pdumper_remember_scalar_impl (void *data, ptrdiff_t nbytes); |