Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transfer TUI Code to Dev Branch #1605

Merged
merged 20 commits into from
Feb 6, 2020
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions manticore/core/manticore.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from ..utils.log import set_verbosity
from ..utils.nointerrupt import WithKeyboardInterruptAs
from .workspace import Workspace
from .worker import WorkerSingle, WorkerThread, WorkerProcess
from .worker import WorkerSingle, WorkerThread, WorkerProcess, MonitorWorker

from multiprocessing.managers import SyncManager
import threading
Expand Down Expand Up @@ -191,7 +191,7 @@ def __init__(self, initial_state, workspace_url=None, policy="random", **kwargs)

During exploration Manticore spawns a number of temporary states that are
maintained in different lists:

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like some dangling whitespace made it in here somehow?

.. code-block:: none

Initial
Expand Down Expand Up @@ -306,6 +306,7 @@ def __init__(self, initial_state, workspace_url=None, policy="random", **kwargs)

# Workers will use manticore __dict__ So lets spawn them last
self._workers = [self._worker_type(id=i, manticore=self) for i in range(consts.procs)]
self._monitor = MonitorWorker(id=-1, manticore=self)
self._is_main = True

def __str__(self):
Expand Down Expand Up @@ -506,6 +507,15 @@ def _get_state(self, wait=False):

return self._load(state_id)

@sync
def count_state_lists(self):
return (
len(self._ready_states),
len(self._busy_states),
len(self._terminated_states),
len(self._killed_states),
)

@sync
def _revive_state(self, state_id):
""" Send a BUSY state back to READY list
Expand Down Expand Up @@ -944,6 +954,8 @@ def run(self):

self._publish("will_run", self.ready_states)
self._running.value = True
self._monitor.start()

# start all the workers!
for w in self._workers:
w.start()
Expand Down
31 changes: 31 additions & 0 deletions manticore/core/state.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
syntax = "proto3";

package mserialize;

message LogMessage{
string content = 1;
}

message State{

enum StateType{
READY = 0;
BUSY = 1;
KILLED = 2;
TERMINATED = 3;
}

int32 id = 2; // state ID
StateType type = 3; // Type of state
string reason = 4; // Reason for execution stopping
int32 num_executing = 5; // number of executing instructions
int32 wait_time = 6;
}

message StateList{
repeated State states = 7;
}

message MessageList{
repeated LogMessage messages = 8;
}
Loading