Skip to content

Commit

Permalink
Use plugin dict to store introspector
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Hennenfent committed Aug 26, 2020
1 parent a40b7a0 commit 8553caa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 3 additions & 2 deletions manticore/core/manticore.py
Original file line number Diff line number Diff line change
Expand Up @@ -1196,8 +1196,9 @@ def introspect(self) -> typing.Dict[int, StateDescriptor]:
:return: the latest copy of the State Descriptor dict
"""
if self._introspector is not None:
return self._introspector.get_state_descriptors()
key = IntrospectionAPIPlugin.NAME
if key in self.plugins:
return self.plugins[key].get_state_descriptors()
return {}

@at_not_running
Expand Down
5 changes: 5 additions & 0 deletions manticore/core/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,8 @@ class IntrospectionAPIPlugin(Plugin):
and stores them in its context, and keeps them up to date whenever a callback registers a change in the State.
"""

NAME = "introspector"

def create_state(self, state_id: int):
"""
Adds a StateDescriptor to the context in the READY state list
Expand Down Expand Up @@ -665,3 +667,6 @@ def get_state_descriptors(self) -> typing.Dict[int, StateDescriptor]:
with self.locked_context("manticore_state", dict) as context:
out = context.copy() # TODO: is this necessary to break out of the lock?
return out

def unique_name(self) -> str:
return IntrospectionAPIPlugin.NAME

0 comments on commit 8553caa

Please sign in to comment.