StackSamplingProfiler: walk a copy of the stack

Changes the stack walking strategy to copy the stack while the target
thread is suspended, then walk the copy of the stack after the thread
has been resumed. This avoids deadlock on locks taken by
RtlLookupFunctionEntry when walking the actual stack while the target
thread is suspended.

BUG=528129

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

Cr-Commit-Position: refs/heads/master@{#353004}
int RecordStack(CONTEXT* context,
int RecordStack(CONTEXT* context, int max_stack_size,
                const void* instruction_pointers[]) {
 #ifdef _WIN64
  Win32StackFrameUnwinder frame_unwinder;
   int i = 0;
   for (; (i < max_stack_size) && context->Rip; ++i) {
     instruction_pointers[i] = reinterpret_cast<const void*>(context->Rip);
    if (!frame_unwinder.TryUnwind(context))
       return i + 1;
   }
   return i;
#else
  return 0;
#endif
}

int RecordStack(CONTEXT* context,
                int max_stack_size,
                const void* instruction_pointers[],
                Win32StackFrameUnwinder* frame_unwinder) {
 #ifdef _WIN64
   int i = 0;
   for (; (i < max_stack_size) && context->Rip; ++i) {
     instruction_pointers[i] = reinterpret_cast<const void*>(context->Rip);
    if (!frame_unwinder->TryUnwind(context))
       return i + 1;
   }
   return i;
#else
  return 0;
#endif
}
