From d4b06784b4fb3816da63d886731bff3bc1a5c04f Mon Sep 17 00:00:00 2001 From: vmordan Date: Mon, 1 Jul 2024 18:51:47 +0500 Subject: [PATCH] Add support for ENV threads ending ENV artifitial thread may end in an error trace before the violation --- scripts/mea/et/internal_witness.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/scripts/mea/et/internal_witness.py b/scripts/mea/et/internal_witness.py index aa3ac2e..7937a04 100644 --- a/scripts/mea/et/internal_witness.py +++ b/scripts/mea/et/internal_witness.py @@ -547,11 +547,20 @@ def final_checks(self, entry_point="main"): is_main_process = False if self._env_threads: cur_thread = 0 + threads = [] for edge in self._edges: - if edge['file'] in self._env_threads: - if 'enter' in edge and edge['enter'] in self._env_threads[edge['file']]: - cur_thread = self._env_threads[edge['file']][edge['enter']] + if edge['file'] in self._env_threads and 'enter' in edge \ + and edge['enter'] in self._env_threads[edge['file']]: + threads.append(cur_thread) + cur_thread = self._env_threads[edge['file']][edge['enter']] edge['thread'] = cur_thread + if edge['file'] in self._env_threads and 'return' in edge and \ + edge['return'] in self._env_threads[edge['file']]: + if threads: + cur_thread = threads.pop() + else: + self._logger.warning( + f"Threads stack is empty, but we got a return to previous thread at {edge}") else: for edge in self._edges: if not is_main_process and 'enter' in edge: