Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
diffoscope
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Reproducible Builds
diffoscope
Commits
07123d53
Commit
07123d53
authored
4 years ago
by
Jean-Romain Garnier
Browse files
Options
Downloads
Patches
Plain Diff
Format macho.py
parent
2853bd7d
No related branches found
No related tags found
1 merge request
!82
Rework macho comparator
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
diffoscope/comparators/macho.py
+26
-23
26 additions, 23 deletions
diffoscope/comparators/macho.py
with
26 additions
and
23 deletions
diffoscope/comparators/macho.py
+
26
−
23
View file @
07123d53
...
...
@@ -142,7 +142,7 @@ class OtoolReadobj(Command):
# Strip filename
prefix
=
f
"
{
self
.
_path
}
:
"
.
encode
(
"
utf-8
"
)
if
line
.
startswith
(
prefix
):
return
line
[
len
(
prefix
):].
strip
()
return
line
[
len
(
prefix
)
:].
strip
()
return
line
...
...
@@ -182,7 +182,7 @@ class OtoolObjdump(Command):
# Strip filename
prefix
=
f
"
{
self
.
_path
}
:
"
.
encode
(
"
utf-8
"
)
if
line
.
startswith
(
prefix
):
return
line
[
len
(
prefix
):].
strip
()
return
line
[
len
(
prefix
)
:].
strip
()
return
line
...
...
@@ -225,6 +225,10 @@ class LlvmReadobj(Command):
self
.
_path
=
path
super
().
__init__
(
path
,
*
args
,
**
kwargs
)
@staticmethod
def
fallback
():
return
None
@tool_required
(
"
llvm-readobj
"
)
def
cmdline
(
self
):
return
[
"
llvm-readobj
"
]
+
self
.
readobj_options
()
+
[
self
.
_path
]
...
...
@@ -300,18 +304,32 @@ class LlvmObjdump(Command):
self
.
_section
=
section
super
().
__init__
(
path
,
*
args
,
**
kwargs
)
@staticmethod
def
fallback
():
return
None
@tool_required
(
"
llvm-objdump
"
)
def
cmdline
(
self
):
return
[
"
llvm-objdump
"
]
+
self
.
objdump_options
()
+
[
self
.
_path
]
def
objdump_options
(
self
):
return
[
"
-arch
"
,
self
.
_arch
,
"
-section
"
,
self
.
_section
,
"
-macho
"
,
"
-demangle
"
,
"
-no-leading-addr
"
,
"
-no-show-raw-insn
"
]
return
[
"
-arch
"
,
self
.
_arch
,
"
-section
"
,
self
.
_section
,
"
-macho
"
,
"
-demangle
"
,
"
-no-leading-addr
"
,
"
-no-show-raw-insn
"
,
"
-line-numbers
"
,
]
def
filter
(
self
,
line
):
# Strip filename
prefix
=
f
"
{
self
.
_path
}
:
"
.
encode
(
"
utf-8
"
)
if
line
.
startswith
(
prefix
):
return
line
[
len
(
prefix
):].
strip
()
return
line
[
len
(
prefix
)
:].
strip
()
return
line
...
...
@@ -334,10 +352,7 @@ class MachoBackend:
differences
=
[]
diff
=
Difference
.
from_operation
(
cmd
,
path1
,
path2
,
operation_args
=
[
arch
,
section_name
],
cmd
,
path1
,
path2
,
operation_args
=
[
arch
,
section_name
]
)
differences
.
append
(
diff
)
...
...
@@ -395,11 +410,7 @@ class LlvmBackend(MachoBackend):
@staticmethod
def
sections
(
path
,
arch
):
cmd
=
[
"
llvm-readobj
"
,
"
-sections
"
,
path
,
]
cmd
=
[
"
llvm-readobj
"
,
"
-sections
"
,
path
]
output
=
our_check_output
(
cmd
,
shell
=
False
)
output
=
output
.
decode
(
"
utf-8
"
)
...
...
@@ -447,10 +458,7 @@ class LlvmBackend(MachoBackend):
return
sections
MACHO_BACKENDS
=
[
OtoolBackend
,
LlvmBackend
,
]
MACHO_BACKENDS
=
[
OtoolBackend
,
LlvmBackend
]
######################
...
...
@@ -567,11 +575,7 @@ class MachoArchitecture(MachoContainerFile):
logger
.
debug
(
"
MachoArchitecture.compare_details is missing tools?
"
)
return
[
Difference
.
from_operation
(
x
,
self
.
path
,
other
.
path
,
)
Difference
.
from_operation
(
x
,
self
.
path
,
other
.
path
)
for
x
in
commands
]
...
...
@@ -644,4 +648,3 @@ class MachoFile(File):
difference
.
check_for_ordering_differences
()
return
[
difference
]
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment