Index: tools/clang/scripts/package.py |
diff --git a/tools/clang/scripts/package.py b/tools/clang/scripts/package.py |
index 780bf5f1dab7919f274d5f6208f51a41bae5c08f..af20db8b5b4234292322d11333987954324f48c1 100755 |
--- a/tools/clang/scripts/package.py |
+++ b/tools/clang/scripts/package.py |
@@ -110,6 +110,55 @@ def MaybeUpload(args, archive_name, platform): |
print ('gsutil %s' % ' '.join(gsutil_args)) |
+def UploadPDBToSymbolServer(): |
+ assert sys.platform == 'win32' |
+ # Upload PDB and binary to the symbol server on Windows. Put them into the |
+ # chromium-browser-symsrv bucket, since chrome devs have that in their |
+ # _NT_SYMBOL_PATH already. Executable and PDB must be at paths following a |
+ # certain pattern for the Microsoft debuggers to be able to load them. |
+ # Executable: |
+ # chromium-browser-symsrv/clang-cl.exe/ABCDEFAB01234/clang-cl.exe |
+ # ABCDEFAB is the executable's timestamp in %08X format, 01234 is the |
+ # executable's image size in %x format. tools/symsrc/img_fingerprint.py |
+ # can compute this ABCDEFAB01234 string for us, so use that. |
+ # XXX put at clang-cl.ex_ and compress? Use symstore.exe? |
+ # PDB: |
+ # gs://chromium-browser-symsrv/clang-cl.exe.pdb/AABBCCDD/clang-cl.dll.pd_ |
+ # AABBCCDD here is computed from the output of |
+ # dumpbin /all mybinary.exe | find "Format: RSDS" |
+ # but tools/symsrc/pdb_fingerprint_from_img.py can compute it already, so |
+ # again just use that. |
+ sys.path.insert(0, os.path.join(CHROMIUM_DIR, 'tools', 'symsrc')) |
+ import img_fingerprint, pdb_fingerprint_from_img |
+ |
+ clang_cl_path = 'bin/clang-cl.exe' |
+ clang_cl_id = img_fingerprint.GetImgFingerprint(img_path) |
+ |
+ # The build process builds clang.exe and then copies it to clang-cl.exe |
+ # (both are the same binary and they behave differently on what their |
+ # filename is). Hence, the pdb is at clang.pdb, not at clang-cl.pdb. |
+ clang_pdb_path = 'bin/clang.pdb' |
+ clang_pdb_id, = img_fingerprint.GetImgFingerprint(img_path) |
+ (clang_pdb_id, clang_pdb_path2) = \ |
+ pdb_fingerprint_from_img.GetPDBInfoFromImg(img_path) |
+ assert clang_pdb_path == clang_pdb_path2 # XXX |
+ |
+ # XXX compress |
+ |
+ gsutil_args = ['cp', '-n', '-a', 'public-read', clang_cl_path, |
+ 'gs://chromium-browser-symsrv/clang-cl.exe/%s/clang-cl.exe' % |
+ img_id] |
+ if RunGsutil(gsutil_args) != 0: |
+ print "gsutil failed" |
+ os.exit(1) |
+ |
+ gsutil_args = ['cp', '-n', '-a', 'public-read', clang_pdb_path, |
+ 'gs://chromium-browser-symsrv/clang.pdb/%s/clang.pdb' % |
Nico
2017/03/08 22:41:12
Should this be clang.pdb/%s/clang.pdb, or clang-cl
|
+ pdb_id] |
+ if RunGsutil(gsutil_args) != 0: |
+ print "gsutil failed" |
+ os.exit(1) |
+ |
def main(): |
parser = argparse.ArgumentParser(description='build and package clang') |
parser.add_argument('--upload', action='store_true', |
@@ -302,6 +351,9 @@ def main(): |
filter=PrintTarProgress) |
MaybeUpload(args, objdumpdir, platform) |
+ if sys.platform == 'win32' and args.upload: |
+ UploadPDBToSymbolServer() |
+ |
# FIXME: Warn if the file already exists on the server. |