nodestack.o clockvector.o main.o snapshot-interface.o cyclegraph.o \
datarace.o impatomic.o cmodelint.o \
snapshot.o malloc.o mymemory.o common.o mutex.o conditionvariable.o \
- context.o execution.o libannotate.o pthread.o futex.o
+ context.o execution.o libannotate.o plugins.o pthread.o futex.o
CPPFLAGS += -Iinclude -I.
LDFLAGS := -ldl -lrt -rdynamic
mo_graph(new CycleGraph())
{
/* Initialize a model-checker thread, for special ModelActions */
- model_thread = new Thread(get_next_id()); // L: Create model thread
- add_thread(model_thread); // L: Add model thread to scheduler
+ model_thread = new Thread(get_next_id());
+ add_thread(model_thread);
scheduler->register_engine(this);
node_stack->register_engine(this);
}
#include "model.h"
#include "params.h"
#include "snapshot-interface.h"
+#include "plugins.h"
static void param_defaults(struct model_params *params)
{
static void print_usage(const char *program_name, struct model_params *params)
{
+ ModelVector<TraceAnalysis *> * registeredanalysis=getRegisteredTraceAnalysis();
/* Reset defaults before printing */
param_defaults(params);
params->verbose,
params->uninitvalue,
params->maxexecutions);
-
+ model_print("Analysis plugins:\n");
+ for(unsigned int i=0;i<registeredanalysis->size();i++) {
+ TraceAnalysis * analysis=(*registeredanalysis)[i];
+ model_print("%s\n", analysis->name());
+ }
exit(EXIT_SUCCESS);
}
+bool install_plugin(char * name) {
+ ModelVector<TraceAnalysis *> * registeredanalysis=getRegisteredTraceAnalysis();
+ ModelVector<TraceAnalysis *> * installedanalysis=getInstalledTraceAnalysis();
+
+ for(unsigned int i=0;i<registeredanalysis->size();i++) {
+ TraceAnalysis * analysis=(*registeredanalysis)[i];
+ if (strcmp(name, analysis->name())==0) {
+ installedanalysis->push_back(analysis);
+ return false;
+ }
+ }
+ model_print("Analysis %s Not Found\n", name);
+ return true;
+}
+
static void parse_options(struct model_params *params, int argc, char **argv)
{
const char *shortopts = "ht:o:e:b:u:x:v::";
case 'u':
params->uninitvalue = atoi(optarg);
break;
-/** case 't':
+ case 't':
if (install_plugin(optarg))
error = true;
break;
error = true;
}
break;
-*/
default: /* '?' */
error = true;
break;
int main_argc;
char **main_argv;
+static void install_trace_analyses(ModelExecution *execution)
+{
+ ModelVector<TraceAnalysis *> * installedanalysis=getInstalledTraceAnalysis();
+ for(unsigned int i=0;i<installedanalysis->size();i++) {
+ TraceAnalysis * ta=(*installedanalysis)[i];
+ ta->setExecution(execution);
+ model->add_trace_analysis(ta);
+ /** Call the installation event for each installed plugin */
+ ta->actionAtInstallation();
+ }
+}
+
/** The model_main function contains the main model checking loop. */
static void model_main()
{
struct model_params params;
param_defaults(¶ms);
+ register_plugins();
parse_options(¶ms, main_argc, main_argv);
snapshot_stack_init();
- model = new ModelChecker(params); // L: Model thread is created
-// install_trace_analyses(model->get_execution()); L: disable plugin
+ model = new ModelChecker(params);
+ install_trace_analyses(model->get_execution());
snapshot_record(0);
model->run();
exit_flag(false),
scheduler(new Scheduler()),
node_stack(new NodeStack()),
- execution(new ModelExecution(this, &this->params, scheduler, node_stack)), // L: Model thread is created inside
+ execution(new ModelExecution(this, &this->params, scheduler, node_stack)),
execution_number(1),
diverge(NULL),
earliest_diverge(NULL),