Skip to content
Snippets Groups Projects
Commit 79189fff authored by Chris Lamb's avatar Chris Lamb :eyes:
Browse files

Don't include specific ".debug"-like lines in the output, as it invariably a...

Don't include specific ".debug"-like lines in the output, as it invariably a duplicate of the debug ID that exists better in the readelf(1) differences for this file.
parent 232aea24
No related branches found
No related tags found
No related merge requests found
......@@ -640,10 +640,29 @@ class ElfContainer(DecompilableContainer):
class Strings(Command):
re_debug_line = re.compile(r"^\s?\w{38,40}\.debug\n$")
@tool_required("strings")
def cmdline(self):
return ("strings", "--all", "--bytes=8", self.path)
def filter(self, line):
val = line.decode("utf-8")
# Don't include specific ".debug"-like lines in the output, as it
# invariably a duplicate of the debug ID that exists better in the
# readelf(1) differences for this file.
#
# For example:
#
# b'0684311d738d2555027e737d5846e7478561fa.debug\n'
# b'·Xu94356212e19a62aadc4db9c3c93076ac997706.debug\n'
#
if self.re_debug_line.match(val):
return b""
return line
class ElfFile(File):
DESCRIPTION = "ELF binaries"
......
......@@ -245,12 +245,10 @@ def test_differences_with_dbgsym(dbgsym_differences):
assert dbgsym_differences.details[2].source1 == "data.tar.xz"
bin_details = dbgsym_differences.details[2].details[0].details[0]
assert bin_details.source1 == "./usr/bin/test"
assert bin_details.details[1].source1.startswith("strings --all")
assert "shstrtab" in bin_details.details[1].unified_diff
assert bin_details.details[2].source1.startswith("objdump")
assert bin_details.details[1].source1.startswith("objdump")
assert (
"test-cases/dbgsym/package/test.c:2"
in bin_details.details[2].unified_diff
in bin_details.details[1].unified_diff
)
......@@ -259,8 +257,8 @@ def test_differences_with_dbgsym(dbgsym_differences):
@skip_unless_module_exists("debian.deb822")
def test_original_gnu_debuglink(dbgsym_differences):
bin_details = dbgsym_differences.details[2].details[0].details[0]
assert ".gnu_debuglink" in bin_details.details[3].source1
assert_diff(bin_details.details[3], "gnu_debuglink_expected_diff")
assert ".gnu_debuglink" in bin_details.details[2].source1
assert_diff(bin_details.details[2], "gnu_debuglink_expected_diff")
def test_ignore_readelf_errors1_identify(ignore_readelf_errors1):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment