----- Nicolas Pomarède wrote:
Le 09/05/2015 00:50, Steven Noonan a écrit :
AFAIK it's primarily meant for snapshots that are used by
the same binary, e.g. when you're actively debugging things.
It's not meant as something portable.
I understand. It's a fair first pass at snapshotting, but it is fragile.
Hi
I'm not satisfied too with current snapshot, it's not flexible enough.
IIRC I posted about this some months ago, with the idea of splitting
every component in it's own structure, doing a kind of linked list :
- component 1 id
- component 1 size
- component 1 data
...
- component n id
- component n size
- component n data
Here are a few more suggestions:
- component n id (maybe the variable name as text)
- component n size (size of the data type)
- component n nmemb (number or elements -- see: $man fread)
- component n data
MemorySnapShot_Store(&Control, sizeof( Control ));
would become:
MemorySnapShot_Store("Control", sizeof( Control ), nmemb, &Control);
This format would allow the format to be endian independent because
the file would be written as bytes (byte file access will never go away).
The snapshot file can even be alphabetically insertion-sorted (quicksort)
as it is made so that it can be quickly parsed for collisions, errors etc.
Saving structures with different data types will require the "name"
text to identify each element. This doesn't have to cause problems
with an alphabetically sorted list, as the full path can be given.