bug 1275424 - hardcode Rust source paths in symbolstore.py. r?chmanchester draft
authorTed Mielczarek <ted@mielczarek.org>
Fri, 23 Jun 2017 16:19:49 -0400
changeset 599946 22c5dd5d2f4c0432efa2f10b354bc6941b908c60
parent 597264 7a6baa6cca3292e8099e652b64d27e74df560874
child 634883 e48c58f8a634ccad2218300fec6e495d149bed31
push id65639
push userbmo:ted@mielczarek.org
push dateFri, 23 Jun 2017 20:26:03 +0000
reviewerschmanchester
bugs1275424
milestone56.0a1
bug 1275424 - hardcode Rust source paths in symbolstore.py. r?chmanchester This gives us source file names with repository info in our generated symbol files, so that crash reports on crash-stats can link to the correct source files for files from the Rust standard library. I've hardcoded the source paths that the Rust project uses, which is not my favorite thing, but there's no simple way to get this information otherwise. MozReview-Commit-ID: 6SeaMqH8xfc
build/moz.configure/rust.configure
toolkit/crashreporter/tools/symbolstore.py
--- a/build/moz.configure/rust.configure
+++ b/build/moz.configure/rust.configure
@@ -229,11 +229,14 @@ set_config('RUST_HOST_TARGET', rust_host
 def rust_target_env_name(triple):
     return triple.upper().replace('-','_')
 
 # We need this to form various Cargo environment variables, as there is no
 # uppercase function in make, and we don't want to shell out just for
 # converting a string to uppercase.
 set_config('RUST_TARGET_ENV_NAME', rust_target_env_name)
 
+# This is used for putting source info into symbol files.
+set_config('RUSTC_COMMIT', depends(rustc_info)(lambda i: i.commit))
+
 # Until we remove all the other Rust checks in old-configure.
 add_old_configure_assignment('RUSTC', rustc)
 add_old_configure_assignment('RUST_TARGET', rust_target_triple)
--- a/toolkit/crashreporter/tools/symbolstore.py
+++ b/toolkit/crashreporter/tools/symbolstore.py
@@ -389,16 +389,30 @@ class Dumper:
             self.archs = ['-a %s' % a for a in archs.split()]
         self.srcdirs = [os.path.normpath(self.FixFilenameCase(a)) for a in srcdirs]
         self.copy_debug = copy_debug
         self.vcsinfo = vcsinfo
         self.srcsrv = srcsrv
         if repo_manifest:
             self.parse_repo_manifest(repo_manifest)
         self.file_mapping = file_mapping or {}
+        # Add a static mapping for Rust sources.
+        target_os = buildconfig.substs['OS_ARCH']
+        rust_srcdir = None
+        if target_os == 'WINNT':
+            rust_srcdir = 'C:/projects/rust/src/'
+        elif target_os == 'Darwin':
+            rust_srcdir = '/Users/travis/build/rust-lang/rust/src/'
+        elif target_os == 'Linux':
+            rust_srcdir = '/checkout/src/'
+        if rust_srcdir is not None:
+            self.srcdirs.append(rust_srcdir)
+            Dumper.srcdirRepoInfo[rust_srcdir] = GitRepoInfo(rust_srcdir,
+                                                             buildconfig.substs['RUSTC_COMMIT'],
+                                                             'https://github.com/rust-lang/rust/')
 
     def parse_repo_manifest(self, repo_manifest):
         """
         Parse an XML manifest of repository info as produced
         by the `repo manifest -r` command.
         """
         doc = parse(repo_manifest)
         if doc.firstChild.tagName != "manifest":