(self, depth=None)
Checks that the paths in the specified path group stay the same over the next
        `depth` bytes.

        The path group should have a "left" and a "right" stash, each with a single
        path.
Checks that the paths in the specified path group stay the same over the next
        `depth` bytes.
Checks that the paths in the specified path group stay the same over the next depth bytes .
def run(self, depth=None):
        """
        Checks that the paths in the specified path group stay the same over the next
        `depth` bytes.

        The path group should have a "left" and a "right" stash, each with a single
        path.
        """
        #pg_history = [ ]
        if len(self.simgr.right) != 1 or len(self.simgr.left) != 1:
            self._report_incongruency("Single path in pg.left and pg.right required.")
            return False

        if "UNICORN" in self.simgr.one_right.options and depth is not None:
            self.simgr.one_right.unicorn.max_steps = depth

        if "UNICORN" in self.simgr.one_left.options and depth is not None:
            self.simgr.one_left.unicorn.max_steps = depth

        l.debug("Performing initial path comparison.")
        if not self.compare_paths(self.simgr.left[0], self.simgr.right[0]):
            self._report_incongruency("Initial path comparison check failed.")
            return False

        while len(self.simgr.left) > 0 and len(self.simgr.right) > 0:
            if depth is not None:
                self._update_progress(100. * float(self.simgr.one_left.history.block_count) / depth)

            if len(self.simgr.deadended) != 0:
                self._report_incongruency("Unexpected deadended paths before step.")
                return False
            if len(self.simgr.right) == 0 and len(self.simgr.left) == 0:
                l.debug("All done!")
                return True
            if len(self.simgr.right) != 1 or len(self.simgr.left) != 1:
                self._report_incongruency("Different numbers of paths in left and right stash..")
                return False

            # do a step
            l.debug(
                "Stepping right path with weighted length %d/%d",
                self.simgr.right[0].history.block_count,
                depth
            )
            self.prev_pg = self.simgr.copy() #pylint:disable=unused-variable
            self.simgr.step(stash='right')
            CongruencyCheck._sync_steps(self.simgr)

            if len(self.simgr.errored) != 0:
                self._report_incongruency("Unexpected errored paths.")
                return False

            try:
                if not self.compare_path_group(self.simgr) and self._validate_incongruency():
                    self._report_incongruency("Path group comparison failed.")
                    return False
            except AngrIncongruencyError:
                if self._validate_incongruency():
                    raise

            if depth is not None:
                self.simgr.drop(stash='left', filter_func=lambda p: p.history.block_count >= depth)
                self.simgr.drop(stash='right', filter_func=lambda p: p.history.block_count >= depth)

            self.simgr.right.sort(key=lambda p: p.addr)
            self.simgr.left.sort(key=lambda p: p.addr)
            self.simgr.stashed_right[:] = self.simgr.stashed_right[::-1]
            self.simgr.stashed_left[:] = self.simgr.stashed_left[::-1]
            self.simgr.move('stashed_right', 'right')
            self.simgr.move('stashed_left', 'left')

            if len(self.simgr.left) > 1:
                self.simgr.split(from_stash='left', limit=1, to_stash='stashed_left')
                self.simgr.split(from_stash='right', limit=1, to_stash='stashed_right')
def run ( self , depth = None ) : #pg_history = [ ] if len ( self . simgr . right ) != 1 or len ( self . simgr . left ) != 1 : self . _report_incongruency ( "Single path in pg.left and pg.right required." ) return False if "UNICORN" in self . simgr . one_right . options and depth is not None : self . simgr . one_right . unicorn . max_steps = depth if "UNICORN" in self . simgr . one_left . options and depth is not None : self . simgr . one_left . unicorn . max_steps = depth l . debug ( "Performing initial path comparison." ) if not self . compare_paths ( self . simgr . left [ 0 ] , self . simgr . right [ 0 ] ) : self . _report_incongruency ( "Initial path comparison check failed." ) return False while len ( self . simgr . left ) > 0 and len ( self . simgr . right ) > 0 : if depth is not None : self . _update_progress ( 100. * float ( self . simgr . one_left . history . block_count ) / depth ) if len ( self . simgr . deadended ) != 0 : self . _report_incongruency ( "Unexpected deadended paths before step." ) return False if len ( self . simgr . right ) == 0 and len ( self . simgr . left ) == 0 : l . debug ( "All done!" ) return True if len ( self . simgr . right ) != 1 or len ( self . simgr . left ) != 1 : self . _report_incongruency ( "Different numbers of paths in left and right stash.." ) return False # do a step l . debug ( "Stepping right path with weighted length %d/%d" , self . simgr . right [ 0 ] . history . block_count , depth ) self . prev_pg = self . simgr . copy ( ) #pylint:disable=unused-variable self . simgr . step ( stash = 'right' ) CongruencyCheck . _sync_steps ( self . simgr ) if len ( self . simgr . errored ) != 0 : self . _report_incongruency ( "Unexpected errored paths." ) return False try : if not self . compare_path_group ( self . simgr ) and self . _validate_incongruency ( ) : self . _report_incongruency ( "Path group comparison failed." ) return False except AngrIncongruencyError : if self . _validate_incongruency ( ) : raise if depth is not None : self . simgr . drop ( stash = 'left' , filter_func = lambda p : p . history . block_count >= depth ) self . simgr . drop ( stash = 'right' , filter_func = lambda p : p . history . block_count >= depth ) self . simgr . right . sort ( key = lambda p : p . addr ) self . simgr . left . sort ( key = lambda p : p . addr ) self . simgr . stashed_right [ : ] = self . simgr . stashed_right [ : : - 1 ] self . simgr . stashed_left [ : ] = self . simgr . stashed_left [ : : - 1 ] self . simgr . move ( 'stashed_right' , 'right' ) self . simgr . move ( 'stashed_left' , 'left' ) if len ( self . simgr . left ) > 1 : self . simgr . split ( from_stash = 'left' , limit = 1 , to_stash = 'stashed_left' ) self . simgr . split ( from_stash = 'right' , limit = 1 , to_stash = 'stashed_right' )