コード例 #1
0
int cbmc_parseoptionst::doit()
{
  if(cmdline.isset("version"))
  {
    std::cout << CBMC_VERSION << std::endl;
    return 0;
  }

  //
  // unwinding of transition systems
  //

  if(cmdline.isset("module") ||
     cmdline.isset("gen-interface"))

  {
    error("This version of CBMC has no support for "
          " hardware modules. Please use hw-cbmc.");
    return 1;
  }
  
  register_languages();

  //
  // command line options
  //

  optionst options;
  get_command_line_options(options);

  bmct bmc(options, context, ui_message_handler);
  set_verbosity(bmc);
  set_verbosity(*this);
  
  if(cmdline.isset("preprocess"))
  {
    preprocessing();
    return 0;
  }

  goto_functionst goto_functions;

  if(get_goto_program(options, bmc, goto_functions))
    return 6;

  if(cmdline.isset("show-claims"))
  {
    const namespacet ns(context);
    show_claims(ns, get_ui(), goto_functions);
    return 0;
  }

  if(set_claims(goto_functions))
    return 7;

  // do actual BMC
  return do_bmc(bmc, goto_functions);
}
コード例 #2
0
ファイル: goto_cc_mode.cpp プロジェクト: danpoe/cbmc
/// constructor
goto_cc_modet::goto_cc_modet(
  goto_cc_cmdlinet &_cmdline,
  const std::string &_base_name,
  message_handlert &_message_handler):
  messaget(_message_handler),
  cmdline(_cmdline),
  base_name(_base_name)
{
  register_languages();
}
コード例 #3
0
ファイル: parseoptions.cpp プロジェクト: olivo/BP
int tan_parseoptionst::doit()
{
  register_languages();

  if(check_and_set_options()) return TAN_UNKNOWN;
  if(from_file(cmdline.args[0])) return TAN_UNKNOWN;  
  if(prepare()) return TAN_UNKNOWN;
  
  return analyze();  
}
コード例 #4
0
ファイル: init.cpp プロジェクト: A-L-E-X/RHVoice
 action_t init::execute()
 {
   try
     {
       tts_engine=engine::create();
       logger::log(3,"Initialized the engine");
       register_languages();
       register_voices();
       synthesizer.start();
       logger::log(2,"Started the synthesis thread");
     }
   catch(const std::exception& e)
     {
       logger::log(2,"Initialization error: ",e.what());
       reply r;
       r("399-",e.what());
       r("399 ERROR CANNOT INITIALIZE MODULE");
       return action_abort;
     }
   reply r;
   r("299-RHVoice initialized");
   r("299 OK LOADED SUCCESSFULLY");
   return action_continue;
 }
コード例 #5
0
int goto_instrument_parse_optionst::doit()
{
  if(cmdline.isset("version"))
  {
    std::cout << CBMC_VERSION << std::endl;
    return 0;
  }
  
  if(cmdline.args.size()!=1 && cmdline.args.size()!=2)
  {
    help();
    return 0;
  }
  
  eval_verbosity();

  try
  {
    register_languages();

    get_goto_program();
    instrument_goto_program();

    if(cmdline.isset("show-value-sets"))
    {
      do_function_pointer_removal();
      do_partial_inlining();
    
      // recalculate numbers, etc.
      goto_functions.update();

      status() << "Pointer Analysis" << eom;
      namespacet ns(symbol_table);
      value_set_analysist value_set_analysis(ns);
      value_set_analysis(goto_functions);

      show_value_sets(get_ui(), goto_functions, value_set_analysis);
      return 0;
    }

    if(cmdline.isset("show-global-may-alias"))
    {
      do_function_pointer_removal();
      do_partial_inlining();
      do_remove_returns();
      parameter_assignments(symbol_table, goto_functions);

      // recalculate numbers, etc.
      goto_functions.update();
      
      namespacet ns(symbol_table);
      global_may_alias_analysist global_may_alias_analysis;
      global_may_alias_analysis(goto_functions, ns);
      global_may_alias_analysis.output(ns, goto_functions, std::cout);

      return 0;
    }

    if(cmdline.isset("show-local-bitvector-analysis"))
    {
      do_function_pointer_removal();
      do_partial_inlining();
      parameter_assignments(symbol_table, goto_functions);
    
      // recalculate numbers, etc.
      goto_functions.update();

      namespacet ns(symbol_table);

      forall_goto_functions(it, goto_functions)
      {
        local_bitvector_analysist local_bitvector_analysis(it->second);
        std::cout << ">>>>" << std::endl;
        std::cout << ">>>> " << it->first << std::endl;
        std::cout << ">>>>" << std::endl;
        local_bitvector_analysis.output(std::cout, it->second, ns);
        std::cout << std::endl;
      }

      return 0;
    }
コード例 #6
0
ファイル: prepare.cpp プロジェクト: olivo/BP
int preparet::doit()
{
  register_languages();

  try
  {
    // do we have a goto binary?
    if(cmdline.args.size()==1 &&
        is_goto_binary(cmdline.args[0]))
    {
      status("Reading GOTO program from file");

      if(read_goto_binary(cmdline.args[0],
            context, goto_functions,
            get_message_handler()))
        return 1;

      config.ansi_c.set_from_context(context);
    }
    else
    {
      //
      // parsing
      //

      if(parse()) return 1;

      //
      // type checking
      //

      if(typecheck()) return 1;

      //
      // final adjustments
      //

      if(final()) return 1;
    }

    {
      int return_value_get_sync_modules=get_sync_modules();
      if(return_value_get_sync_modules>=0)
        return return_value_get_sync_modules;
    }

    {
      int return_value_get_async_modules=get_async_modules();
      if(return_value_get_async_modules>=0)
        return return_value_get_async_modules;
    }

    if(cmdline.isset("show-claims"))
    {
      show_claims(ns, get_ui(), goto_functions);
      return 0;
    }

    // get the user provided predicates

    if(cmdline.isset("predicates"))
      get_predicates(
          cmdline.getval("predicates"),
          get_message_handler(),
          ns,
          user_provided_predicates);
  }

  catch(const char *e)
  {
    error(e);
    return 1;
  }

  catch(const std::string e)
  {
    error(e);
    return 1;
  }

  catch(int)
  {
    return 1;
  }

  return -1; // proceed!
}
コード例 #7
0
ファイル: cbmc_parse_options.cpp プロジェクト: martin-cs/cbmc
int cbmc_parse_optionst::doit()
{
  if(cmdline.isset("version"))
  {
    std::cout << CBMC_VERSION << std::endl;
    return 0;
  }
  
  //
  // command line options
  //

  optionst options;
  get_command_line_options(options);
  eval_verbosity();

  //
  // Print a banner
  //
  status() << "CBMC version " CBMC_VERSION " "
           << sizeof(void *)*8 << "-bit "
           << config.this_architecture() << " "
           << config.this_operating_system() << eom;

  //
  // Unwinding of transition systems is done by hw-cbmc.
  //

  if(cmdline.isset("module") ||
     cmdline.isset("gen-interface"))

  {
    error() << "This version of CBMC has no support for "
               " hardware modules. Please use hw-cbmc." << eom;
    return 1;
  }
  
  register_languages();
  
  if(cmdline.isset("test-preprocessor"))
    return test_c_preprocessor(ui_message_handler)?8:0;
  
  if(cmdline.isset("preprocess"))
  {
    preprocessing();
    return 0;
  }

  goto_functionst goto_functions;

  // get solver
  cbmc_solverst cbmc_solvers(options, symbol_table, ui_message_handler);
  cbmc_solvers.set_ui(get_ui());

  std::unique_ptr<cbmc_solverst::solvert> cbmc_solver;
  
  try
  {
    cbmc_solver=cbmc_solvers.get_solver();
  }
  
  catch(const char *error_msg)
  {
    error() << error_msg << eom;
    return 1;
  }

  prop_convt &prop_conv=cbmc_solver->prop_conv();

  bmct bmc(options, symbol_table, ui_message_handler, prop_conv);

  int get_goto_program_ret=
    get_goto_program(options, bmc, goto_functions);

  if(get_goto_program_ret!=-1)
    return get_goto_program_ret;

  label_properties(goto_functions);

  if(cmdline.isset("show-claims") || // will go away
     cmdline.isset("show-properties")) // use this one
  {
    const namespacet ns(symbol_table);
    show_properties(ns, get_ui(), goto_functions);
    return 0;
  }

  if(cmdline.isset("show-reachable-properties")) // may replace --show-properties
  {
    const namespacet ns(symbol_table);
    
    // Entry point will have been set before and function pointers removed
    status() << "Removing Unused Functions" << eom;
    remove_unused_functions(goto_functions, ui_message_handler);
    
    show_properties(ns, get_ui(), goto_functions);
    return 0;
  }

  if(set_properties(goto_functions))
    return 7;

  if(cmdline.isset("danger"))
    return run_danger(options, result(), symbol_table, goto_functions);
  if(cmdline.isset("safety"))
    return run_safety(options, result(), symbol_table, goto_functions);

  // do actual BMC
  return do_bmc(bmc, goto_functions);
}
コード例 #8
0
int goto_fence_inserter_parse_optionst::doit()
{
  if(cmdline.isset("version"))
  {
    std::cout << MUSKETEER_VERSION << std::endl;
    return 0;
  }

  if(cmdline.args.size()!=1 && cmdline.args.size()!=2)
  {
    help();
    return 0;
  }

  set_verbosity();

  try
  {
    register_languages();

    goto_functionst goto_functions;

    get_goto_program(goto_functions);

    instrument_goto_program(goto_functions);

    // write new binary?
    if(cmdline.args.size()==2)
    {
      status() << "Writing GOTO program to " << cmdline.args[1] << eom;

      if(write_goto_binary(
        cmdline.args[1], symbol_table, goto_functions, get_message_handler()))
        return 1;
      else
        return 0;
    }

    // help();
    return 0;
  }

  catch(const char *e)
  {
    error() << e << eom;
    return 11;
  }

  catch(const std::string e)
  {
    error() << e << eom;
    return 11;
  }

  catch(int)
  {
    return 11;
  }

  catch(std::bad_alloc)
  {
    error() << "Out of memory" << eom;
    return 11;
  }
}