Bug 1337986 - Modify symbolstore.py to operate on dll/exe files. r=ted

This will be more convenient when we dump symbols from the compile tier.

MozReview-Commit-ID: Ltjq8ai5j0m

--HG--
extra : rebase_source : bcb059879b1dbadb2e84caa41247fd129629eb37
This commit is contained in:
Chris Manchester 2017-04-10 10:27:49 -07:00
Родитель 03bb24b8ba
Коммит 16f0994a36
2 изменённых файлов: 15 добавлений и 15 удалений

Просмотреть файл

@ -705,7 +705,7 @@ class Dumper:
self.output(sys.stdout, rel_path) self.output(sys.stdout, rel_path)
if self.srcsrv and vcs_root: if self.srcsrv and vcs_root:
# add source server indexing to the pdb file # add source server indexing to the pdb file
self.SourceServerIndexing(file, guid, sourceFileStream, vcs_root) self.SourceServerIndexing(debug_file, guid, sourceFileStream, vcs_root)
# only copy debug the first time if we have multiple architectures # only copy debug the first time if we have multiple architectures
if self.copy_debug and arch_num == 0: if self.copy_debug and arch_num == 0:
self.CopyDebug(file, debug_file, guid, self.CopyDebug(file, debug_file, guid,
@ -731,13 +731,13 @@ class Dumper_Win32(Dumper):
fixedFilenameCaseCache = {} fixedFilenameCaseCache = {}
def ShouldProcess(self, file): def ShouldProcess(self, file):
"""This function will allow processing of pdb files that have dll """This function will allow processing of exe or dll files that have pdb
or exe files with the same base name next to them.""" files with the same base name next to them."""
if not Dumper.ShouldProcess(self, file): if not Dumper.ShouldProcess(self, file):
return False return False
if file.endswith(".pdb"): if file.endswith(".exe") or file.endswith(".dll"):
(path,ext) = os.path.splitext(file) path, ext = os.path.splitext(file)
if os.path.isfile(path + ".exe") or os.path.isfile(path + ".dll"): if os.path.isfile(path + ".pdb"):
return True return True
return False return False
@ -788,6 +788,7 @@ class Dumper_Win32(Dumper):
return result return result
def CopyDebug(self, file, debug_file, guid, code_file, code_id): def CopyDebug(self, file, debug_file, guid, code_file, code_id):
file = "%s.pdb" % os.path.splitext(file)[0]
def compress(path): def compress(path):
compressed_file = path[:-1] + '_' compressed_file = path[:-1] + '_'
# ignore makecab's output # ignore makecab's output
@ -836,7 +837,6 @@ class Dumper_Win32(Dumper):
def SourceServerIndexing(self, debug_file, guid, sourceFileStream, vcs_root): def SourceServerIndexing(self, debug_file, guid, sourceFileStream, vcs_root):
# Creates a .pdb.stream file in the mozilla\objdir to be used for source indexing # Creates a .pdb.stream file in the mozilla\objdir to be used for source indexing
debug_file = os.path.abspath(debug_file)
streamFilename = debug_file + ".stream" streamFilename = debug_file + ".stream"
stream_output_path = os.path.abspath(streamFilename) stream_output_path = os.path.abspath(streamFilename)
# Call SourceIndex to create the .stream file # Call SourceIndex to create the .stream file

Просмотреть файл

@ -31,19 +31,19 @@ def write_elf(filename):
def write_macho(filename): def write_macho(filename):
open(filename, "wb").write(struct.pack("<I28x", 0xfeedface)) open(filename, "wb").write(struct.pack("<I28x", 0xfeedface))
def write_pdb(filename): def write_dll(filename):
open(filename, "w").write("aaa") open(filename, "w").write("aaa")
# write out a fake DLL too # write out a fake PDB too
open(os.path.splitext(filename)[0] + ".dll", "w").write("aaa") open(os.path.splitext(filename)[0] + ".pdb", "w").write("aaa")
def target_platform(): def target_platform():
return buildconfig.substs['OS_TARGET'] return buildconfig.substs['OS_TARGET']
writer = {'WINNT': write_pdb, writer = {'WINNT': write_dll,
'Linux': write_elf, 'Linux': write_elf,
'Sunos5': write_elf, 'Sunos5': write_elf,
'Darwin': write_macho}[target_platform()] 'Darwin': write_macho}[target_platform()]
extension = {'WINNT': ".pdb", extension = {'WINNT': ".dll",
'Linux': ".so", 'Linux': ".so",
'Sunos5': ".so", 'Sunos5': ".so",
'Darwin': ".dylib"}[target_platform()] 'Darwin': ".dylib"}[target_platform()]
@ -219,8 +219,8 @@ class TestCopyDebug(HelperMixin, unittest.TestCase):
""" """
Test that CopyDebug copies binaries as well on Windows. Test that CopyDebug copies binaries as well on Windows.
""" """
test_file = os.path.join(self.test_dir, 'foo.pdb') test_file = os.path.join(self.test_dir, 'foo.dll')
write_pdb(test_file) write_dll(test_file)
code_file = 'foo.dll' code_file = 'foo.dll'
code_id = 'abc123' code_id = 'abc123'
self.stdouts.append(mock_dump_syms('X' * 33, 'foo.pdb', self.stdouts.append(mock_dump_syms('X' * 33, 'foo.pdb',
@ -541,7 +541,7 @@ class TestFunctional(HelperMixin, unittest.TestCase):
self.target_bin = os.path.join(buildconfig.topobjdir, self.target_bin = os.path.join(buildconfig.topobjdir,
'browser', 'browser',
'app', 'app',
'firefox.pdb') 'firefox.exe')
else: else:
self.dump_syms = os.path.join(buildconfig.topobjdir, self.dump_syms = os.path.join(buildconfig.topobjdir,
'dist', 'host', 'bin', 'dist', 'host', 'bin',