[clang] Add debugging printfs to the Win ASan runtime

The cherry-picked patch does three things:

1) It changes ASan's VPrintf function to store any output above
   the current verbosity level, which would otherwise have been
   discarded, to an internal fixed-size buffer.
2) It adds code to dump that buffer on some code paths, such as on
   CHECK() failures.
3) It adds VPrintf calls throughout the Windows interception code,
   to make it easier to follow that process either by running with
   ASAN_OPTIONS=verbosity=5 or when a failure occurs.

The linked bug has so far proved hard to reproduce locally and on
trybots. By landing this, the idea is that we will get the information
we need when the bug does pop up on a buildbot, without disturbing
successful runs.

Bug: 341936875
Change-Id: I4b7b7e4c6bf7780b1a29289fbdb274335dc84f37
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5853980
Auto-Submit: Hans Wennborg <hans@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1354490}
NOKEYCHECK=True
GitOrigin-RevId: aa89dcf8ac1e11af405411f4908745698cff8cb6
diff --git a/build_rust.py b/build_rust.py
index 9be237f..0ff1da0 100755
--- a/build_rust.py
+++ b/build_rust.py
@@ -55,8 +55,8 @@
                  'scripts'))
 
 from build import (AddCMakeToPath, AddZlibToPath, CheckoutGitRepo, CopyFile,
-                   DownloadDebianSysroot, GetLibXml2Dirs, LLVM_BUILD_TOOLS_DIR,
-                   RunCommand)
+                   DownloadDebianSysroot, GetLibXml2Dirs, GitCherryPick,
+                   LLVM_BUILD_TOOLS_DIR, RunCommand)
 from update import (CHROMIUM_DIR, DownloadAndUnpack, EnsureDirExists,
                     GetDefaultHostOs, RmTree, UpdatePackage)
 
@@ -553,25 +553,6 @@
         ])
 
 
-def GitCherryPick(git_repository, git_remote, commit):
-    print(f'Cherry-picking {commit} in {git_repository} from {git_remote}')
-    git_cmd = ['git', '-C', git_repository]
-    RunCommand(git_cmd + ['remote', 'add', 'github', git_remote],
-               fail_hard=False)
-    RunCommand(git_cmd +
-               ['fetch', '--recurse-submodules=no', 'github', commit])
-    is_ancestor = RunCommand(git_cmd +
-                             ['merge-base', '--is-ancestor', commit, 'HEAD'],
-                             fail_hard=False)
-    if is_ancestor:
-        print('Commit already an ancestor; skipping.')
-        return
-    RunCommand([
-        'git', '-C', git_repository, 'cherry-pick', '--keep-redundant-commits',
-        commit
-    ])
-
-
 # Move a git submodule to point to a different branch.
 #
 # This is super non-trivial because the submodules are shallow, and thus