home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.unix.wizards:5317 comp.unix.programmer:5768 comp.unix.questions:14902
- Newsgroups: comp.unix.wizards,comp.unix.programmer,comp.unix.questions
- Path: sparky!uunet!usc!zaphod.mps.ohio-state.edu!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!spool.mu.edu!darwin.sura.net!convex!news.oc.com!utacfd.uta.edu!rwsys!sneaky!gordon
- From: gordon@sneaky.lonestar.org (Gordon Burditt)
- Subject: Re: Portability issues in using a memory dump
- Message-ID: <BzoHJ9.798@sneaky.lonestar.org>
- Organization: Gordon Burditt
- References: <1992Dec17.222402.18347@sj.ate.slb.com> <1992Dec21.165835.17205@thunder.mcrcim.mcgill.edu>
- Date: Tue, 22 Dec 1992 20:42:38 GMT
- Lines: 26
-
- >Yes. The difference is usually fairly minor; most UNIXish systems just
- >give you text/data/stack at runtime, so if you dump out the data
- >segment you should be OK, even though the data segment may begin at a
- >different address and be a different size from system to system. If
-
- One of the biggest ugly problems with this technique is saving
- and later restoring data that you don't know exists. Some of
- the things you might end up restoring are:
-
- - Your terminal type, and internal curses/termcap/terminfo variables
- related to it. Bad news if you restart on a different terminal type.
- - Stdio information about open files that aren't open in the restoring
- process. This often includes the FILE * stream used to save the data.
- - On fixed-stack machines, your stack and all auto variables may be
- included in what you are restoring. KABOOM!
- - Environment variables, or copies made of them by library routines.
- - Malloc and sbrk's records of memory allocation.
-
- At least one version of the game rogue used this technique, although
- it tried saving data AND bss AND malloc space. I rapidly learned to
- hate it. Save/restore cycles ended up leaking memory, FILE * descriptors,
- and after a couple dozen cycles, the game generally fell apart with
- SIGSEGV's.
-
- Gordon L. Burditt
- sneaky.lonestar.org!gordon
-