Refactor showmap into libsmapinfo

This change refactors showmap by moving functions into libsmapinfo. This
is done in order to eventually output showmap/librank/procrank
information for bug reports with a single read of smaps.

This change also re-adds a total-count increment (in run_showmap) that
was mistakenly left out in a previous change.

showmap functionality is mostly unchanged, but the reading of smaps info
from smapinfo's ProcessRecord objects is possibly significant for kernel
threads, which have no associated memory maps. Previously, running
'showmap <kernel pid>' resulted in empty showmap formatting [1]. This
was because 'showmap <pid>' opened the /proc/<pid>/smaps file, found
nothing, then returned. Now, 'showmap <pid>' creates a ProcessRecord,
stores no maps, then returns false for the subsequent call to
ForEachExistingVma(collect_vma) because no maps exist. This is
functionally the same, but results in different output [2].

In bugreports, the above difference will manifest as a "failed"
invocation of showmap [3] on kernel pids. This is planned to be fixed
when showmap, librank, and procrank are called in bugreports as a single
binary instead of separately.

[1]: go/paste/5896599258529792
[2]: go/paste/6329743522660352
[3]: go/paste/5931424329760768

Test: Checked that showmap still functions as expected, both in the
      command-line tool and in bug reports.
Bug: 229147699

Change-Id: Iaf7925efb33d670bb076f98968bd4036245f1e45
4 files changed