Generate and upload breakpad symbols if BREAKPAD_SYMBOL_SERVER variable is set. (bug 5229, r=dvander)

This commit is contained in:
Asher Baker 2012-02-17 03:28:02 +00:00
parent 393c54fdc2
commit e154f3edb7
3 changed files with 60 additions and 8 deletions

View File

@ -401,7 +401,8 @@ FileList = [
['sourcepawn', 'jit', 'AMBuilder'],
['sourcepawn', 'compiler', 'AMBuilder'],
['plugins', 'AMBuilder'],
['tools', 'buildbot', 'PackageScript']
['tools', 'buildbot', 'PackageScript'],
['tools', 'buildbot', 'BreakpadSymbols']
]
for parts in FileList:

View File

@ -0,0 +1,41 @@
# vim: set ts=2 sw=2 tw=99 noet ft=python:
import os
import urllib.request
from ambuild.command import Command
from ambuild.command import ShellCommand
class IterateDebugInfoCommand(Command):
def run(self, master, job):
pdblog = open(os.path.join(AMBuild.outputFolder, 'pdblog.txt'), 'rt')
for debug_info in pdblog:
debug_info = os.path.join(AMBuild.outputFolder, debug_info.strip())
job.AddCommand(SymbolCommand(debug_info, symbolServer))
pdblog.close()
class SymbolCommand(ShellCommand):
def __init__(self, debugFile, symbolServer):
self.serverResponse = None
self.symbolServer = symbolServer
if AMBuild.target['platform'] == 'linux':
cmdstring = "dump_syms {0} {1}".format(debugFile, os.path.dirname(debugFile))
elif AMBuild.target['platform'] == 'darwin':
cmdstring = "dump_syms {0}".format(debugFile)
elif AMBuild.target['platform'] == 'windows':
cmdstring = "dump_syms.exe {0}".format(debugFile)
ShellCommand.__init__(self, cmdstring)
def run(self, master, job):
ShellCommand.run(self, master, job)
if self.stdout != None and len(self.stdout) > 0:
request = urllib.request.Request(symbolServer, self.stdout.encode('utf-8'))
request.add_header("Content-Type", "text/plain")
self.serverResponse = urllib.request.urlopen(request).read().decode('utf-8')
def spew(self, runner):
if self.stderr != None and len(self.stderr) > 0:
runner.PrintOut(self.stderr)
if self.serverResponse != None and len(self.serverResponse) > 0:
runner.PrintOut(self.serverResponse)
if 'BREAKPAD_SYMBOL_SERVER' in os.environ:
symbolServer = os.environ['BREAKPAD_SYMBOL_SERVER']
job = AMBuild.AddJob('breakpad-symbols')
job.AddCommand(IterateDebugInfoCommand())

View File

@ -186,7 +186,14 @@ bincopies = []
def AddNormalLibrary(name, dest):
dest = os.path.join('addons', 'sourcemod', dest)
bincopies.append(CopyFile(os.path.join('..', name, name + osutil.SharedLibSuffix()), dest))
pdb_list.append(name + '\\' + name + '.pdb')
# Each platform's version of dump_syms needs the path in a different format.
if AMBuild.target['platform'] == 'linux':
debug_info.append(name + '/' + name + '.so')
elif AMBuild.target['platform'] == 'darwin':
debug_info.append(name + '/' + name + '.dylib.dSYM')
elif AMBuild.target['platform'] == 'windows':
debug_info.append(name + '\\' + name + '.pdb')
def AddHL2Library(name, dest):
for i in SM.sdkInfo:
@ -195,18 +202,20 @@ def AddHL2Library(name, dest):
continue
AddNormalLibrary(name + '.' + sdk['ext'], dest)
pdb_list = []
debug_info = []
if AMBuild.target['platform'] == 'linux':
bincopies.append(CopyFile(os.path.join('..', 'loader', 'sourcemod_mm_i486.so'),
os.path.join('addons', 'sourcemod', 'bin')))
debug_info.append('loader/sourcemod_mm_i486.so')
elif AMBuild.target['platform'] == 'darwin':
bincopies.append(CopyFile(os.path.join('..', 'loader', 'sourcemod_mm.dylib'),
os.path.join('addons', 'sourcemod', 'bin')))
debug_info.append('loader/sourcemod_mm.dylib.dSYM')
elif AMBuild.target['platform'] == 'windows':
bincopies.append(CopyFile(os.path.join('..', 'loader', 'sourcemod_mm.dll'),
os.path.join('addons', 'sourcemod', 'bin')))
pdb_list.append('loader\\sourcemod_mm.pdb')
debug_info.append('loader\\sourcemod_mm.pdb')
AddHL2Library('sourcemod', 'bin')
AddNormalLibrary('sourcemod.logic', 'bin')
@ -233,8 +242,9 @@ if AMBuild.target['platform'] == 'windows':
job.AddCommand(CopyFile(
os.path.join(AMBuild.sourceFolder, 'sourcepawn', 'batchtool', 'compile.exe'),
os.path.join('addons', 'sourcemod', 'scripting')))
pdblog = open(os.path.join(AMBuild.outputFolder, 'pdblog.txt'), 'wt')
for pdb in pdb_list:
pdblog.write(pdb + '\n')
pdblog.close()
pdblog = open(os.path.join(AMBuild.outputFolder, 'pdblog.txt'), 'wt')
for pdb in debug_info:
pdblog.write(pdb + '\n')
pdblog.close()