arbiter icon indicating copy to clipboard operation
arbiter copied to clipboard

Redundant code in sa_advanced.py

Open yyyayo opened this issue 2 years ago • 1 comments

Hi,

Do these codes have the same meaning? I think some of them maybe redundant.

            all_matches = []
            for x in self._checkpoint:
                all_matches += list(filter(lambda y: x in y, names))

from line 482,

            for x in checkpoints.copy():
                if x not in names:
                    checkpoints.pop(x)
            if len(checkpoints) == 0:
                # Default to function entry
                target.source = target.addr
            else:
                target.source = checkpoints

from line 512, and

            filtered_checkpoints = {}
            for x in checkpoints.copy():
                for y in names:
                    if x in y:
                        filtered_checkpoints[y] = self._checkpoint[x]

            target.source = filtered_checkpoints if len(filtered_checkpoints) > 0 else target.addr

from line 521.

yyyayo avatar Jun 09 '22 11:06 yyyayo

I agree. Especially the blocks at line 512 and 521 seem to be practically redundant. I'm working on cleaning up the code a bit, but it might take some time. Feel free to submit a PR though!

jkrshnmenon avatar Aug 11 '22 14:08 jkrshnmenon