The branch "master" has been updated in SBCL:
via 76f7887e98cbc10b4cd23e81b3e5cdfcc35c8741 (commit)
from e62bb3a4b9633dbd898fca05cc4af3dd0a16e0aa (commit)
- Log -----------------------------------------------------------------
commit 76f7887e98cbc10b4cd23e81b3e5cdfcc35c8741
Author: David Lichteblau <david@...>
Date: Thu Aug 25 20:35:34 2011 +0200
Allow use of the --core option with embedded core files
Thanks to Anton Kovalenko for implementation suggestions.
---
NEWS | 2 ++
src/runtime/coreparse.c | 10 ++++++++++
src/runtime/runtime.c | 13 +++++++++++++
3 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/NEWS b/NEWS
index c28c716..453c9c9 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,8 @@
;;;; -*- coding: utf-8; fill-column: 78 -*-
changes relative to sbcl-1.0.50:
* enhancement: ASDF has been updated to version 2.017.
+ * enhancement: the --core command line option now accepts binaries with
+ an embedded core.
* optimization: SLEEP no longer conses.
* optimization: *PRINT-PRETTY* no longer slows down printing of strings
or bit-vectors when using the standard pretty-print dispatch table.
diff --git a/src/runtime/coreparse.c b/src/runtime/coreparse.c
index 1757444..56daffd 100644
--- a/src/runtime/coreparse.c
+++ b/src/runtime/coreparse.c
@@ -115,6 +115,16 @@ search_for_embedded_core(char *filename)
if ((fd = open_binary(filename, O_RDONLY)) < 0)
goto lose;
+
+ if (read(fd, &header, (size_t)lispobj_size) < lispobj_size)
+ goto lose;
+ if (header == CORE_MAGIC) {
+ /* This file is a real core, not an embedded core. Return 0 to
+ * indicate where the core starts, and do not look for runtime
+ * options in this case. */
+ return 0;
+ }
+
if (lseek(fd, -lispobj_size, SEEK_END) < 0)
goto lose;
if (read(fd, &header, (size_t)lispobj_size) < lispobj_size)
diff --git a/src/runtime/runtime.c b/src/runtime/runtime.c
index d1a215b..1396573 100644
--- a/src/runtime/runtime.c
+++ b/src/runtime/runtime.c
@@ -533,6 +533,19 @@ main(int argc, char *argv[], char *envp[])
fflush(stdout);
}
+ if (embedded_core_offset == 0) {
+ /* Here we make a last attempt at recognizing an embedded core,
+ * so that a file with an embedded core is a valid argument to
+ * --core. We take care that any decisions on special behaviour
+ * (suppressed banner, embedded options) have already been made
+ * before we reach this block, so that there is no observable
+ * difference between "embedded" and "bare" images given to
+ * --core. */
+ os_vm_offset_t offset = search_for_embedded_core(core);
+ if (offset != -1)
+ embedded_core_offset = offset;
+ }
+
#if defined(SVR4) || defined(__linux__) || defined(__NetBSD__)
tzset();
#endif
-----------------------------------------------------------------------
hooks/post-receive
--
SBCL
|