-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
bugSomething is brokenSomething is broken
Description
Description
__________________________________________________________ TestDecompiler.test_decompiling_true_a_x86_64_0 ___________________________________________________________
self = <tests.analyses.decompiler.test_decompiler.TestDecompiler testMethod=test_decompiling_true_a_x86_64_0>
decompiler_options = [(<DecOption [Structuring] Structuring algorithm (recursive_structurer.structurer_cls)>, 'sailr')]
@for_all_structuring_algos
def test_decompiling_true_a_x86_64_0(self, decompiler_options=None):
bin_path = os.path.join(test_location, "x86_64", "true_a")
p = angr.Project(bin_path, auto_load_libs=False, load_debug_info=True)
cfg = p.analyses[CFGFast].prep(show_progressbar=not WORKER)(normalize=True, data_references=True)
# disable any optimization which may duplicate code to remove gotos since we need them for the switch
# structure to be recovered
all_optimization_passes = DECOMPILATION_PRESETS["full"].get_optimization_passes(
"AMD64", "linux", disable_opts=DUPLICATING_OPTS
)
f = cfg.functions[0x401E60]
dec = p.analyses[Decompiler].prep(show_progressbar=not WORKER)(
f, cfg=cfg.model, options=decompiler_options, optimization_passes=all_optimization_passes
)
assert dec.codegen is not None, f"Failed to decompile function {f!r}."
print_decompilation_result(dec)
> assert dec.codegen.text.count("switch (") == 3 # there are three switch-cases in total
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E assert 4 == 3
E + where 4 = <built-in method count of str object at 0x563228cfb4f0>('switch (')
E + where <built-in method count of str object at 0x563228cfb4f0> = 'typedef struct mbstate_t {\n} mbstate_t;\n\n\nlong long sub_401e60(char *a0, unsigned long long a1, unsigned long a2,... v2 = 2;\n v55 = 1;\n v6 = 1;\n v5 = 0;\n v15 = "\'";\n v24 = v38;\n }\n}\n'.count
E + where 'typedef struct mbstate_t {\n} mbstate_t;\n\n\nlong long sub_401e60(char *a0, unsigned long long a1, unsigned long a2,... v2 = 2;\n v55 = 1;\n v6 = 1;\n v5 = 0;\n v15 = "\'";\n v24 = v38;\n }\n}\n' = <CStructuredCodeGenerator Analysis Result at 0x7f29bfb1e3c0>.text
E + where <CStructuredCodeGenerator Analysis Result at 0x7f29bfb1e3c0> = <Decompiler Analysis Result at 0x7f29c53e6270>.codegen
tests/analyses/decompiler/test_decompiler.py:433: AssertionError
See #5773
Steps to reproduce the bug
Run test
Environment
angr @ 96db64d
Additional context
No response
Metadata
Metadata
Assignees
Labels
bugSomething is brokenSomething is broken