]> khamidou — GitHub mirrors - electron.git/commitdiff
linux: Generate symbols from the symbol file.
authorCheng Zhao <zcbenz@gmail.com>
Tue, 11 Mar 2014 09:04:41 +0000 (09:04 +0000)
committerCheng Zhao <zcbenz@gmail.com>
Tue, 11 Mar 2014 09:04:41 +0000 (09:04 +0000)
script/create-dist.py
tools/posix/generate_breakpad_symbols.py

index ef3f9a9bbaf810ad4ce2dae0d641d66bddcbc574..f96f34ce4b5eb5a5601047d9453610dc954478bc 100755 (executable)
@@ -28,6 +28,12 @@ TARGET_PLATFORM = {
   'win32': 'win32',
 }[sys.platform]
 
+SYMBOL_NAME = {
+  'darwin': 'libchromiumcontent.dylib.dSYM',
+  'linux': 'libchromiumcontent.so.dbg',
+  'win32': 'chromiumcontent.dll.pdb',
+}[TARGET_PLATFORM]
+
 TARGET_BINARIES = {
   'darwin': [
   ],
@@ -81,11 +87,8 @@ def main():
 
   args = parse_args()
 
-  if TARGET_PLATFORM == 'linux':
-    clean_build()
   force_build()
-  if TARGET_PLATFORM != 'linux':
-    download_libchromiumcontent_symbols(args.url)
+  download_libchromiumcontent_symbols(args.url)
   create_symbols()
   copy_binaries()
   copy_headers()
@@ -107,16 +110,6 @@ def parse_args():
   return parser.parse_args()
 
 
-def clean_build():
-  # On Linux stripping binary would cause them to be rebuilt next time, which
-  # would make create-dist create symbols from stripped binary if it has been
-  # ran for twice.
-  # So in order to make sure we built correct symbols everytime, we have to
-  # force a rebuild of the binaries.
-  for binary in TARGET_BINARIES[TARGET_PLATFORM]:
-    safe_unlink(os.path.join(OUT_DIR, binary))
-
-
 def force_build():
   build = os.path.join(SOURCE_ROOT, 'script', 'build.py')
   execute([sys.executable, build, '-c', 'Release'])
@@ -170,14 +163,9 @@ def create_version():
 
 
 def download_libchromiumcontent_symbols(url):
-  if TARGET_PLATFORM == 'darwin':
-    symbols_name = 'libchromiumcontent.dylib.dSYM'
-  elif TARGET_PLATFORM == 'win32':
-    symbols_name = 'chromiumcontent.dll.pdb'
-
   brightray_dir = os.path.join(SOURCE_ROOT, 'vendor', 'brightray', 'vendor')
   target_dir = os.path.join(brightray_dir, 'download', 'libchromiumcontent')
-  symbols_path = os.path.join(target_dir, 'Release', symbols_name)
+  symbols_path = os.path.join(target_dir, 'Release', SYMBOL_NAME)
   if os.path.exists(symbols_path):
     return
 
index 7563bc422338416bf8077adf4669b44e7e7431e9..770f5b01efdbb9a0da25c5e13c4dc381389faa67 100755 (executable)
@@ -75,6 +75,16 @@ def GetDSYMBundle(options, binary_path):
   return binary_path
 
 
+def GetSymbolPath(options, binary_path):
+  """Finds the .dbg to the binary."""
+  filename = os.path.basename(binary_path)
+  dbg_path = os.path.join(options.libchromiumcontent_dir, filename) + '.dbg'
+  if os.path.exists(dbg_path):
+    return dbg_path
+
+  return binary_path
+
+
 def Resolve(path, exe_path, loader_path, rpaths):
   """Resolve a dyld path.
 
@@ -178,6 +188,8 @@ def GenerateSymbols(options, binaries):
 
       if sys.platform == 'darwin':
         binary = GetDSYMBundle(options, binary)
+      elif sys.platform == 'linux2':
+        binary = GetSymbolPath(options, binary)
 
       syms = GetCommandOutput([GetDumpSymsBinary(options.build_dir), '-r', '-c',
                                binary])