Stack sampling profiler: handle unloading and unloaded modules

Attempt to increment the reference count for the module at the
instruction pointer before unwinding the frame. If successful the module
is guaranteed be in memory while the stack is being processed. If not
successful, the module has been unloaded and unwinding from the frame is
not possible.

Fixes crashes attempting to unwind frames from modules that get unloaded
between copying the stack and walking the copy of the stack.

In theory it could happen that a module is unloaded then another module
is immediately loaded in a similar memory region, such that the new
module contains an instruction pointer associated with the unloaded
module. This likely would result in a crash unwinding the frame with the
instruction pointer. It's not clear that there's anything that can be
done to detect/avoid this case; the hope is that it occurs rarely.

BUG=545051

Review URL: https://codereview.chromium.org/1423583002

Cr-Commit-Position: refs/heads/master@{#357453}
15 files changed