How to use the gilgamesh.snes.state.State.from_expr function in gilgamesh

To help you get started, we’ve selected a few gilgamesh examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github AndreaOrru / gilgamesh / tests / test_state.py View on Github external
def test_from_state_expr(self):
        state = State.from_expr("m=0,x=1")
        self.assertEqual(state, State(m=0, x=1))

        state = State.from_expr("x=0,m=1")
        self.assertEqual(state, State(x=0, m=1))
github AndreaOrru / gilgamesh / tests / test_state.py View on Github external
def test_from_state_expr(self):
        state = State.from_expr("m=0,x=1")
        self.assertEqual(state, State(m=0, x=1))

        state = State.from_expr("x=0,m=1")
        self.assertEqual(state, State(x=0, m=1))
github AndreaOrru / gilgamesh / gilgamesh / app.py View on Github external
def do_entrypoint(self, pc: str, name: str, state_expr: str) -> None:
        """Add an entry point to the analysis.

        STATE_EXPR can accept the following values:
          - "m=0,x=0" -> The subroutine changes the state of m to 0 and x to 0.
          - "m=0,x=1" -> The subroutine changes the state of m to 0 and x to 1.
          - "m=1,x=0" -> The subroutine changes the state of m to 1 and x to 0.
          - "m=1,x=1" -> The subroutine changes the state of m to 1 and x to 1."""
        if not pc.startswith("$"):
            raise GilgameshError("Please specify a valid address.")
        pc_int = self._label_to_pc(pc)
        state = State.from_expr(state_expr)
        self.log.add_entry_point(pc_int, name, state)