home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / unix / programm / 3953 < prev    next >
Encoding:
Internet Message Format  |  1992-07-28  |  2.4 KB

  1. Xref: sparky comp.unix.programmer:3953 comp.unix.questions:9478 gnu.misc.discuss:2562 gnu.gcc.help:1787 comp.unix.ultrix:5927
  2. Newsgroups: comp.unix.programmer,comp.unix.questions,gnu.misc.discuss,gnu.gcc.help,comp.unix.ultrix
  3. Path: sparky!uunet!darwin.sura.net!jvnc.net!yale.edu!ira.uka.de!math.fu-berlin.de!zrz.tu-berlin.de!cs.tu-berlin.de!net
  4. From: net@cs.tu-berlin.de (Oliver Laumann)
  5. Subject: Re: help with unexec
  6. Message-ID: <1992Jul28.100513.29858@cs.tu-berlin.de>
  7. Sender: news@cs.tu-berlin.de
  8. Organization: Technical University of Berlin, Germany
  9. References: <1992Jul28.014955.21272@ulowell.ulowell.edu>
  10. Date: Tue, 28 Jul 1992 10:05:13 GMT
  11. Lines: 35
  12.  
  13. dnicodem@cs.ulowell.edu (David Nicodemus) writes:
  14. > I am looking for a way to force a program out of execution, and save an
  15. > image of the program that can be restarted from the same point at a later
  16. > time. 
  17. > It appears that the gnu unexec() function from gnu emacs will do this;
  18. > however, the last parameter asks for a "starting address." 
  19. > How can I find this "starting address" (which I want to be the current
  20. > point of execution)?  Is this even possible?
  21.  
  22. I'm not sure I understand what exactly you want to accomplish.  You
  23. certainly cannot *force* a program to dump its image to disk using
  24. unexec(); the program must call unexec() voluntarily.
  25.  
  26. The entry point you can supply to unexec() is the address where the
  27. a.out file produced by unexec() will start when it is invoked later.
  28. Every a.out file has an entry point; it's part of the a.out header.
  29.  
  30. Anyway, when using unexec(), you cannot have the newly created a.out
  31. file resume execution at the point where the original invocation saved
  32. its image.  To be able to do this, unexec() would have to save not only
  33. the text and data segment of the running program, but also the entire
  34. execution state (stack and registers).
  35.  
  36. The `Elk' Scheme interpreter (export.lcs.mit.edu:contrib/elk-1.5a.tar.Z)
  37. does have the function which you seem to be looking for; it is named
  38. `dump'.  `dump' creates an a.out file which, when invoked, causes the
  39. invocation of `dump' that created this file to return.  In this case,
  40. the return value of `dump' is true, while it returns false in the
  41. original invocation of the program (not unlike the fork() system call).
  42.  
  43. However, the functionality of `dump' is based on Scheme's continuations;
  44. so it's probably of little or no use without the rest of the Scheme
  45. interpreter.
  46.