From a52c595e175869d3e5b007747bfb14272affa2d7 Mon Sep 17 00:00:00 2001 From: Alessandro Di Federico Date: Mon, 7 Mar 2022 23:06:34 +0100 Subject: [PATCH] Update test results --- python/revng/cli/model_dump/__init__.py | 13 ++-- tests/analysis/mips/switch-jump-table.yml | 62 +++++++++---------- tests/analysis/x86_64/call.yml | 14 ++--- tests/analysis/x86_64/fibonacci.yml | 44 ++++++------- tests/analysis/x86_64/indirect-call.yml | 18 +++--- tests/analysis/x86_64/indirect-tail-call.yml | 10 +-- tests/analysis/x86_64/longjmp.yml | 26 ++++---- .../switch-jump-table-32-bit-comparison.yml | 48 +++++++------- tests/analysis/x86_64/switch-jump-table.yml | 44 ++++++------- tests/analysis/x86_64/try-catch-ehframe.yml | 24 +++---- 10 files changed, 152 insertions(+), 151 deletions(-) diff --git a/python/revng/cli/model_dump/__init__.py b/python/revng/cli/model_dump/__init__.py index 805c906df..b1fe5998a 100644 --- a/python/revng/cli/model_dump/__init__.py +++ b/python/revng/cli/model_dump/__init__.py @@ -29,7 +29,7 @@ class MetaAddressRemapper: def handle(self, value): if is_metaaddress(value): - self.addresses.add(value) + self.addresses.add(value.split(":")[0]) def collect(self, value): if isinstance(value, dict): @@ -45,11 +45,12 @@ class MetaAddressRemapper: self.handle(value) def apply_replacement(self, value): - return ( - self.replacements[value] - if (isinstance(value, str) and value in self.replacements) - else value - ) + if isinstance(value, str): + splits = value.split(":") + if is_metaaddress(value) and splits[0] in self.replacements: + + return self.replacements[splits[0]] + return value def replace(self, value): if isinstance(value, dict): diff --git a/tests/analysis/mips/switch-jump-table.yml b/tests/analysis/mips/switch-jump-table.yml index b8069f8d5..8f6e7c43a 100644 --- a/tests/analysis/mips/switch-jump-table.yml +++ b/tests/analysis/mips/switch-jump-table.yml @@ -1,53 +1,53 @@ --- Functions: - CFG: - - End: '2' - Start: '1' + - End: '5' + Start: '4' Successors: - - Destination: '2' - Type: DirectBranch - - Destination: '4' - Type: DirectBranch - - End: '3' - Start: '2' - Successors: - - Destination: '3' - Type: DirectBranch - Destination: '5' Type: DirectBranch - - End: '4' - Start: '3' - Successors: - - Destination: '6' - Type: DirectBranch - Destination: '7' Type: DirectBranch - - Destination: '8' - Type: DirectBranch - - End: '9' - Start: '4' - Successors: - - Destination: ":Invalid" - Type: IndirectTailCall - - End: '9' + - End: '6' Start: '5' Successors: - - Destination: ":Invalid" - Type: IndirectTailCall - - End: '9' + - Destination: '6' + Type: DirectBranch + - Destination: '8' + Type: DirectBranch + - End: '7' Start: '6' Successors: - - Destination: ":Invalid" - Type: IndirectTailCall - - End: '9' + - Destination: '9' + Type: DirectBranch + - Destination: '10' + Type: DirectBranch + - Destination: '11' + Type: DirectBranch + - End: '12' Start: '7' Successors: - Destination: ":Invalid" Type: IndirectTailCall - - End: '9' + - End: '12' Start: '8' Successors: - Destination: ":Invalid" Type: IndirectTailCall + - End: '12' + Start: '9' + Successors: + - Destination: ":Invalid" + Type: IndirectTailCall + - End: '12' + Start: '10' + Successors: + - Destination: ":Invalid" + Type: IndirectTailCall + - End: '12' + Start: '11' + Successors: + - Destination: ":Invalid" + Type: IndirectTailCall OriginalName: __start Type: NoReturn diff --git a/tests/analysis/x86_64/call.yml b/tests/analysis/x86_64/call.yml index fc09b1898..af5fa7db9 100644 --- a/tests/analysis/x86_64/call.yml +++ b/tests/analysis/x86_64/call.yml @@ -1,21 +1,21 @@ --- Functions: - CFG: - - End: '4' - Start: '2' + - End: '2' + Start: '1' Successors: - - Destination: '5' + - Destination: '3' Type: FunctionCall - - End: '5' - Start: '4' + - End: '3' + Start: '2' Successors: - Destination: ":Invalid" Type: Return OriginalName: _start Type: Regular - CFG: - - End: '6' - Start: '5' + - End: '4' + Start: '3' Successors: - Destination: ":Invalid" Type: Return diff --git a/tests/analysis/x86_64/fibonacci.yml b/tests/analysis/x86_64/fibonacci.yml index 730e8aa5c..24bcededc 100644 --- a/tests/analysis/x86_64/fibonacci.yml +++ b/tests/analysis/x86_64/fibonacci.yml @@ -1,43 +1,43 @@ --- Functions: - CFG: - - End: '4' + - End: '2' + Start: '1' + Successors: + - Destination: '2' + Type: DirectBranch + - Destination: '5' + Type: DirectBranch + - End: '3' Start: '2' Successors: - - Destination: '4' - Type: DirectBranch - - Destination: '7' - Type: DirectBranch + - Destination: '1' + Type: FunctionCall + - End: '4' + Start: '3' + Successors: + - Destination: '1' + Type: FunctionCall - End: '5' Start: '4' Successors: - - Destination: '2' - Type: FunctionCall + - Destination: '5' + Type: DirectBranch - End: '6' Start: '5' Successors: - - Destination: '2' - Type: FunctionCall - - End: '7' - Start: '6' - Successors: - - Destination: '7' - Type: DirectBranch - - End: '8' - Start: '7' - Successors: - Destination: ":Invalid" Type: Return OriginalName: fibonacci Type: Regular - CFG: - - End: '9' - Start: '8' + - End: '7' + Start: '6' Successors: - - Destination: '2' + - Destination: '1' Type: FunctionCall - - End: '10' - Start: '9' + - End: '8' + Start: '7' Successors: - Destination: ":Invalid" Type: Return diff --git a/tests/analysis/x86_64/indirect-call.yml b/tests/analysis/x86_64/indirect-call.yml index 4b437e14e..3d63905fc 100644 --- a/tests/analysis/x86_64/indirect-call.yml +++ b/tests/analysis/x86_64/indirect-call.yml @@ -1,26 +1,26 @@ --- Functions: - CFG: - - End: '4' - Start: '2' + - End: '2' + Start: '1' Successors: - - Destination: '5' + - Destination: '3' Type: FunctionCall - - End: '5' - Start: '4' + - End: '3' + Start: '2' Successors: - Destination: ":Invalid" Type: Return OriginalName: _start Type: Regular - CFG: - - End: '6' - Start: '5' + - End: '4' + Start: '3' Successors: - Destination: ":Invalid" Type: IndirectCall - - End: '7' - Start: '6' + - End: '5' + Start: '4' Successors: - Destination: ":Invalid" Type: Return diff --git a/tests/analysis/x86_64/indirect-tail-call.yml b/tests/analysis/x86_64/indirect-tail-call.yml index 0d7091dae..1cd0ccf86 100644 --- a/tests/analysis/x86_64/indirect-tail-call.yml +++ b/tests/analysis/x86_64/indirect-tail-call.yml @@ -1,18 +1,18 @@ --- Functions: - CFG: - - End: '4' - Start: '2' + - End: '2' + Start: '1' Successors: - Attributes: - NoReturn - Destination: '5' + Destination: '3' Type: FunctionCall OriginalName: _start Type: NoReturn - CFG: - - End: '6' - Start: '5' + - End: '4' + Start: '3' Successors: - Destination: ":Invalid" Type: IndirectTailCall diff --git a/tests/analysis/x86_64/longjmp.yml b/tests/analysis/x86_64/longjmp.yml index 2e5969f6b..53514ab7e 100644 --- a/tests/analysis/x86_64/longjmp.yml +++ b/tests/analysis/x86_64/longjmp.yml @@ -1,33 +1,33 @@ --- Functions: - CFG: - - End: '4' - Start: '2' + - End: '2' + Start: '1' Successors: - - Destination: '5' + - Destination: '3' Type: FunctionCall - - End: '5' - Start: '4' + - End: '3' + Start: '2' Successors: - Destination: ":Invalid" Type: Return OriginalName: _start Type: Regular - CFG: - - End: '6' - Start: '5' + - End: '4' + Start: '3' Successors: - - Destination: '6' + - Destination: '4' Type: DirectBranch - - Destination: '7' + - Destination: '5' Type: DirectBranch - - End: '8' - Start: '6' + - End: '6' + Start: '4' Successors: - Destination: ":Invalid" Type: LongJmp - - End: '8' - Start: '7' + - End: '6' + Start: '5' Successors: - Destination: ":Invalid" Type: Return diff --git a/tests/analysis/x86_64/switch-jump-table-32-bit-comparison.yml b/tests/analysis/x86_64/switch-jump-table-32-bit-comparison.yml index ebe39f49b..71fd95178 100644 --- a/tests/analysis/x86_64/switch-jump-table-32-bit-comparison.yml +++ b/tests/analysis/x86_64/switch-jump-table-32-bit-comparison.yml @@ -1,50 +1,50 @@ --- Functions: - CFG: - - End: '4' + - End: '2' + Start: '1' + Successors: + - Destination: '2' + Type: DirectBranch + - Destination: '6' + Type: DirectBranch + - End: '6' Start: '2' Successors: + - Destination: '3' + Type: DirectBranch - Destination: '4' Type: DirectBranch - - Destination: '8' - Type: DirectBranch - - End: '8' - Start: '4' - Successors: - Destination: '5' Type: DirectBranch - Destination: '6' Type: DirectBranch - Destination: '7' Type: DirectBranch - - Destination: '8' - Type: DirectBranch - - Destination: '9' - Type: DirectBranch - - End: '8' + - End: '6' + Start: '3' + Successors: + - Destination: ":Invalid" + Type: Return + - End: '6' + Start: '4' + Successors: + - Destination: ":Invalid" + Type: Return + - End: '6' Start: '5' Successors: - Destination: ":Invalid" Type: Return - - End: '8' + - End: '7' Start: '6' Successors: - - Destination: ":Invalid" - Type: Return + - Destination: '7' + Type: DirectBranch - End: '8' Start: '7' Successors: - Destination: ":Invalid" Type: Return - - End: '9' - Start: '8' - Successors: - - Destination: '9' - Type: DirectBranch - - End: '10' - Start: '9' - Successors: - - Destination: ":Invalid" - Type: Return OriginalName: _start Type: Regular diff --git a/tests/analysis/x86_64/switch-jump-table.yml b/tests/analysis/x86_64/switch-jump-table.yml index 49a53c6f3..fe5feb6f9 100644 --- a/tests/analysis/x86_64/switch-jump-table.yml +++ b/tests/analysis/x86_64/switch-jump-table.yml @@ -1,43 +1,43 @@ --- Functions: - CFG: - - End: '4' + - End: '2' + Start: '1' + Successors: + - Destination: '2' + Type: DirectBranch + - Destination: '6' + Type: DirectBranch + - End: '3' Start: '2' Successors: + - Destination: '3' + Type: DirectBranch - Destination: '4' Type: DirectBranch - - Destination: '8' - Type: DirectBranch - - End: '5' - Start: '4' - Successors: - Destination: '5' Type: DirectBranch - Destination: '6' Type: DirectBranch - - Destination: '7' - Type: DirectBranch - - Destination: '8' - Type: DirectBranch - - End: '8' + - End: '6' + Start: '3' + Successors: + - Destination: ":Invalid" + Type: Return + - End: '6' + Start: '4' + Successors: + - Destination: ":Invalid" + Type: Return + - End: '6' Start: '5' Successors: - Destination: ":Invalid" Type: Return - - End: '8' + - End: '7' Start: '6' Successors: - Destination: ":Invalid" Type: Return - - End: '8' - Start: '7' - Successors: - - Destination: ":Invalid" - Type: Return - - End: '9' - Start: '8' - Successors: - - Destination: ":Invalid" - Type: Return OriginalName: _start Type: Regular diff --git a/tests/analysis/x86_64/try-catch-ehframe.yml b/tests/analysis/x86_64/try-catch-ehframe.yml index fdb009a8d..a752da739 100644 --- a/tests/analysis/x86_64/try-catch-ehframe.yml +++ b/tests/analysis/x86_64/try-catch-ehframe.yml @@ -1,32 +1,32 @@ --- Functions: - CFG: - - End: '4' - Start: '2' + - End: '2' + Start: '1' Successors: - Destination: ":Invalid" Type: Return OriginalName: function_call Type: Regular - CFG: + - End: '3' + Start: '2' + Successors: + - Destination: '1' + Type: FunctionCall + - End: '4' + Start: '3' + Successors: + - Destination: '4' + Type: DirectBranch - End: '5' Start: '4' Successors: - - Destination: '2' - Type: FunctionCall - - End: '6' - Start: '5' - Successors: - Destination: '6' Type: DirectBranch - End: '7' Start: '6' Successors: - - Destination: '8' - Type: DirectBranch - - End: '9' - Start: '8' - Successors: - Destination: ":Invalid" Type: Return OriginalName: _start