This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Unexec gurus?
- To: Bernard dot Urban at meteo dot fr
- Subject: Unexec gurus?
- From: "Greg J. Badros" <gjb at cs dot washington dot edu>
- Date: 28 Jan 2000 10:51:41 -0800
- Cc: guile at sourceware dot cygnus dot com
I'm again trying to get guile-hobbit's unexec support working with
Scwm. This time I'm pretty determined to dig down until I figure out
what's going wrong, but I need some help to figure this out.
So far, I've whittled down the startup execution of scwm to be (nearly)
exactly that of tguile-core. Scwm's main just calls
scm_boot_guile(argc, argv, scwm_main, 0);
and scwm_main is, except for some additional unused variables, starts
exactly the same as tguile's inner_main which its scm_boot_guile uses:
static void
scwm_main(void *closure, int argc, char **argv)
{
static int dumped = 0;
#ifdef ENABLE_DUMP
static Bool fShouldDump = False;
static char *szBinaryPath = NULL;
static char *szDumpFile = NULL;
#endif
/* extra vars elided here */
if (argc >= 3 && !strcmp(argv[1], "--dump")) {
int i;
/* module initializations would go here */
#ifdef DUMP_INIT
DUMP_INIT
#endif
for (i = 3; i < argc; i++) {
printf("loading `%s'\n", argv[i]);
scm_primitive_load(scm_makfrom0str(argv[i]));
}
dumped = 1;
dodump(argv[0], argv[2]);
exit (0);
} else {
if (dumped) {
scwm_init_after_dump();
}
scm_shell(argc, argv);
}
/* real scwm startup here */
}
I'm just trying to make a really simple test to see if I can get a
dumped version of the scwm executable that has the pre-loaded
definitions intact. I'm using test-dump.scm that contains just the
single line:
(define a 1)
and then doing:
guile-hobbit-1.3.4/unexec/tguile --dump tguile-dumped test-dump.scm
or
scwm/src/scwm --dump scwm-dumped test-dump.scm
and both tguile and Scwm appear to dump their process state reasonably
(and behave identically when single stepping through GDB) and produce
executables that do restart successfully.
HOWEVER, when single-stepping through tguile-dumped and scwm-dumped in
GDB, there is an important behavioural difference that I cannot explain:
In starting the dumped executables, Guile's init.c's scm_boot_guile_1,
the "static int initialized" variable that is used there does not appear
to have the value "1" for the dumped scwm, but does for the dumped
tguile. Both did set that variable correctly when dumping, but Scwm's
dumped executable somehow has lost that state. I'm looking for
suggestions for why that might be.
There are several things different between the tguile and scwm-- the
most significant may be:
Scwm has a lot more global variables
Scwm links with a lot more libraries
Scwm has large program and data segments
Any and all thoughts are appreciated. I'm no unexec guru, but I'm
heading off to read more of the unexec sources now to see if I can
figure anything else out from that.
Thanks,
Greg