diff --git a/src/elf_diff/pair_report_document.py b/src/elf_diff/pair_report_document.py index 063155d..ec9cf86 100644 --- a/src/elf_diff/pair_report_document.py +++ b/src/elf_diff/pair_report_document.py @@ -693,6 +693,13 @@ def __init__(self): "persisting", Properties(Doc(None)), Value("count", Doc("Number of symbols"), Type(int)), + Value( + "assembly_differs_count", + Doc( + "Number of persisting symbols with assembly differences" + ), + Type(int), + ), Node( "resource_consumption", Properties( @@ -989,6 +996,7 @@ def configureValueTree(self, value_tree_node: ValueTreeNode, **kwargs: Any) -> N persisting_symbols_overall_size_difference = 0 persisting_symbols_overall_size_old = 0 persisting_symbols_overall_size_new = 0 + persisting_symbols_assembly_differs_count = 0 for symbol_name in self.binary_pair.persisting_symbol_names: old_symbol: ElfSymbol = old_binary.symbols[symbol_name] @@ -996,6 +1004,9 @@ def configureValueTree(self, value_tree_node: ValueTreeNode, **kwargs: Any) -> N size_difference: int = new_symbol.size - old_symbol.size + if old_symbol.instructions != new_symbol.instructions: + persisting_symbols_assembly_differs_count += 1 + if (size_difference == 0) and settings.consider_equal_sized_identical: continue @@ -1129,6 +1140,9 @@ def configureValueTree(self, value_tree_node: ValueTreeNode, **kwargs: Any) -> N document.statistics.symbols.persisting.count = len( self.binary_pair.persisting_symbol_names ) + document.statistics.symbols.persisting.assembly_differs_count = ( + persisting_symbols_assembly_differs_count + ) document.statistics.symbols.persisting.resource_consumption.delta = ( persisting_symbols_overall_size_difference ) diff --git a/src/elf_diff/plugins/export/txt/plugin.py b/src/elf_diff/plugins/export/txt/plugin.py index f3c5a94..bb4fe50 100644 --- a/src/elf_diff/plugins/export/txt/plugin.py +++ b/src/elf_diff/plugins/export/txt/plugin.py @@ -78,6 +78,7 @@ def export(self, document: ValueTreeNode): or (len(document.symbols.appeared) > 0) or (len(document.symbols.similar) > 0) or (len(document.symbols.migrated) > 0) + or (document.statistics.symbols.persisting.assembly_differs_count > 0) ) with open(self.getConfigurationParameter("output_file"), "w") as f: @@ -98,6 +99,8 @@ def export(self, document: ValueTreeNode): old: {len(document.symbols.old)} new: {len(document.symbols.new)} persisting: {len(document.symbols.persisting)} + persisting with assembly differences: + {document.statistics.symbols.persisting.assembly_differs_count} disappeared: {len(document.symbols.disappeared)} appeared: {len(document.symbols.appeared)} similar: {len(document.symbols.similar)}