Improvements to ELF program segment parsing.

- also, a stab a script for validating the JSON emitted after
  serializing the in-memory representation of the ELF file to
  move towards automated testing.