Massively simplify handling of corefile's saved memory size options
commit48e0a06a72705ade366114098fd3f49d8827edf2
authorDouglas Katzman <dougk@google.com>
Tue, 12 Dec 2017 13:57:08 +0000 (12 08:57 -0500)
committerDouglas Katzman <dougk@google.com>
Tue, 12 Dec 2017 14:18:45 +0000 (12 09:18 -0500)
tree7d39458ba65877f9f3b3684c71905ed6ab8114c6
parent3b247b629b0de1cebdb2d90e92588333dbda3b66
Massively simplify handling of corefile's saved memory size options

* Save the options as the first core entry immediately following
  the core header magic word, not as trailer words.

* Rename runtime_options to 'memsize_options' so not to imply that
  it preserves any other runtime options.

* Don't malloc a structure of 2 words, don't make it global.

* Kill two single-use functions, use fewer goto statements,
  and fix file descriptor leak in search_for_embedded_core().

* Fix bug in S-L-A-D from an image started with an executable core that was
  specified as a "--core" command-line argument. Such usage should treat the
  core in every respect as if it were *not* an embedded core, so that changing
  the memory size options works (among other things).  However, saving from
  that image would incorrectly use the memory sizes options originally saved
  in the executable core because search_for_embedded_core() always altered
  the global options despite not using them in the "--core" mode.
  This strange behavior seemed clearly to be an accident, not by design.
src/runtime/core.h
src/runtime/coreparse.c
src/runtime/elf.c
src/runtime/globals.h
src/runtime/runtime-options.h [deleted file]
src/runtime/runtime.c
src/runtime/save.c
tests/core.test.sh