cmd/viewcore: add --exe option to accept the binary path

This is more convenient than --base when the local copy of the program
is located in a random place.

This change assumes that the first entry appearing in the note file
section corresponds to the main binary, and if --exe is supplied, use
the user-supplied binary instead.

Manual tested:
$ viewcore core --exe=tmp/test mappings
              min              max perm         source       original
           400000           401000  r-x      core@3000     tmp/test@0
           401000           451000  r-x  tmp/test@1000
           451000           4aa000  r-- tmp/test@51000
           4aa000           4cc000  rw-      core@4000 tmp/test@aa000
       c000000000       c000001000  rw-     core@26000

Change-Id: I3e9e008da324ec57427a60eebdca2f459eceda53
Reviewed-by: Heschi Kreinick <>
4 files changed