diff --git a/AMBuildScript b/AMBuildScript index 77d63362..006a5e92 100644 --- a/AMBuildScript +++ b/AMBuildScript @@ -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: diff --git a/tools/buildbot/BreakpadSymbols b/tools/buildbot/BreakpadSymbols new file mode 100644 index 00000000..7d40e8e4 --- /dev/null +++ b/tools/buildbot/BreakpadSymbols @@ -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()) diff --git a/tools/buildbot/PackageScript b/tools/buildbot/PackageScript index 031b7723..3d09e8d9 100644 --- a/tools/buildbot/PackageScript +++ b/tools/buildbot/PackageScript @@ -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()