[diffoscope] 01/01: comparators.macho: If the If the LLVM disassembler does not work, try the internal one. (Closes: #886736)

Chris Lamb chris at chris-lamb.co.uk
Wed Jan 10 06:31:15 CET 2018


This is an automated email from the git hooks/post-receive script.

lamby pushed a commit to branch master
in repository diffoscope.

commit 59dc18184ea11f3efc0236acb914e6355e8493ad
Author: Chris Lamb <lamby at debian.org>
Date:   Wed Jan 10 10:58:19 2018 +0530

    comparators.macho: If the If the LLVM disassembler does not work, try the internal one. (Closes: #886736)
---
 diffoscope/comparators/macho.py | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/diffoscope/comparators/macho.py b/diffoscope/comparators/macho.py
index 338bac1..65e02d2 100644
--- a/diffoscope/comparators/macho.py
+++ b/diffoscope/comparators/macho.py
@@ -67,6 +67,11 @@ class OtoolDisassemble(Otool):
         return super().otool_options() + ['-tdvV']
 
 
+class OtoolDisassembleInternal(Otool):
+    def otool_options(self):
+        return super().otool_options() + ['-tdvVQ']
+
+
 class MachoFile(File):
     FILE_TYPE_RE = re.compile(r'^Mach-O ')
     RE_EXTRACT_ARCHS = re.compile(r'^(?:Architectures in the fat file: .* are|Non-fat file: .* is architecture): (.*)$')
@@ -96,7 +101,24 @@ class MachoFile(File):
                                                        comment="Mach-O headers for architecture %s" % common_arch))
             differences.append(Difference.from_command(OtoolLibraries, self.path, other.path, command_args=[common_arch],
                                                        comment="Mach-O load commands for architecture %s" % common_arch))
-            differences.append(Difference.from_command(OtoolDisassemble, self.path, other.path, command_args=[common_arch],
-                                                       comment="Code for architecture %s" % common_arch))
+
+            x = Difference.from_command(
+                OtoolDisassemble,
+                self.path,
+                other.path,
+                command_args=[common_arch],
+                comment="Code for architecture %s" % common_arch,
+            )
+            differences.append(x)
+
+            # If the LLVM disassembler does not work, try the internal one.
+            if x is None:
+                differences.append(Difference.from_command(
+                    OtoolDisassembleInternal,
+                    self.path,
+                    other.path,
+                    command_args=[common_arch],
+                    comment="Code for architecture %s (internal disassembler)" % common_arch,
+                ))
 
         return differences

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git


More information about the diffoscope mailing list