Ejemplo n.º 1
0
 void start()
 {
     QScriptDebuggerCommandSchedulerFrontend frontend(commandScheduler(), this);
     frontend.scheduleGetScripts();
 }
int QScriptDebuggerConsoleGlobalObject::scheduleGetPropertiesByIterator(int id, int count)
{
    Q_D(QScriptDebuggerConsoleGlobalObject);
    QScriptDebuggerCommandSchedulerFrontend frontend(d->scheduler, d->responseHandler);
    return frontend.scheduleGetPropertiesByIterator(id, count);
}
int QScriptDebuggerConsoleGlobalObject::scheduleScriptValueToString(const QScriptDebuggerValue &value)
{
    Q_D(QScriptDebuggerConsoleGlobalObject);
    QScriptDebuggerCommandSchedulerFrontend frontend(d->scheduler, d->responseHandler);
    return frontend.scheduleScriptValueToString(value);
}
int QScriptDebuggerConsoleGlobalObject::scheduleResolveScript(const QString &fileName)
{
    Q_D(QScriptDebuggerConsoleGlobalObject);
    QScriptDebuggerCommandSchedulerFrontend frontend(d->scheduler, d->responseHandler);
    return frontend.scheduleResolveScript(fileName);
}
int QScriptDebuggerConsoleGlobalObject::scheduleGetContextInfo(int contextIndex)
{
    Q_D(QScriptDebuggerConsoleGlobalObject);
    QScriptDebuggerCommandSchedulerFrontend frontend(d->scheduler, d->responseHandler);
    return frontend.scheduleGetContextInfo(contextIndex);
}
int QScriptDebuggerConsoleGlobalObject::scheduleForceReturn(int contextIndex, const QScriptDebuggerValue &value)
{
    Q_D(QScriptDebuggerConsoleGlobalObject);
    QScriptDebuggerCommandSchedulerFrontend frontend(d->scheduler, d->responseHandler);
    return frontend.scheduleForceReturn(contextIndex, value);
}
int QScriptDebuggerConsoleGlobalObject::scheduleSetBreakpointData(int id, const QScriptBreakpointData &data)
{
    Q_D(QScriptDebuggerConsoleGlobalObject);
    QScriptDebuggerCommandSchedulerFrontend frontend(d->scheduler, d->responseHandler);
    return frontend.scheduleSetBreakpointData(id, data);
}
Ejemplo n.º 8
0
int
main(int argc, char **argv)
{
	int c, retval, size = 0;
	int lflag = 0,
	    iflag = 0,
	    aflag = 0,
	    vflag = 0;
	char *tmpptr;

	Translator_info T_info;

	prog = basename(argv[0]);

	T_info.ti_verbosity = 0;
	T_info.ti_flags = 0;
	T_info.ti_dash_I = NULL;
	T_info.ti_output_file = NULL;
	T_info.ti_libtype = NORMALLIB;
	T_info.ti_versfile = "version";

	while ((c = getopt(argc, argv, "FVpd:v:l:o:I:a:")) != EOF) {
		switch (c) {
		case 'F':
			/* Library is a filter */
			T_info.ti_libtype = FILTERLIB;
			break;
		case 'a':
			/* set the target architecture */
			if ((T_info.ti_archtoken = arch_strtoi(optarg)) == 0) {
				errlog(ERROR,
				    "Error: architecture specified must "
				    "be one of: i386, sparc, sparcv9, "
				    "ia64 or amd64\n");
				usage();
			}
			T_info.ti_arch = optarg;
			++aflag;
			break;
		case 'V':
			/* print the version info */
			(void) fprintf(stderr,
			    "%s Version %s\n", prog, SPEC_PARSER_VERSION);
			return (0);
			break;
		case 'd':
			/* set debugging level */
			if (!isdigit(*optarg) ||
			    (T_info.ti_verbosity = atoi(optarg)) < 0) {
				errlog(ERROR,
				    "Error: -d option must be given a "
				    "positive integer argument\n");
				usage();
			}
			break;
		case 'l':
			/* set library name */
			++lflag;
			if (!isalnum(optarg[0])) {
				errlog(ERROR,
				    "Error: -l must be given the name of "
				    "a library as an argument\n");
				usage();
			}
			T_info.ti_liblist = optarg;
			break;
		case 'I':
			/* set path to spec files */
			++iflag;
			if (iflag == 1) {
				size = 1;
			} else {
				(void) strcat(T_info.ti_dash_I, ":");
				size = strlen(T_info.ti_dash_I);
			}
			tmpptr = realloc(T_info.ti_dash_I,
			    sizeof (char) * (size + strlen(optarg) + 3));
			if (tmpptr == NULL) {
				errlog(ERROR | FATAL,
				    "Error: Unable to allocate memory "
				    "for command line arguments\n");
			}
			T_info.ti_dash_I = tmpptr;
			if (iflag == 1) {
				(void) strcpy(T_info.ti_dash_I, optarg);
			} else {
				(void) strcat(T_info.ti_dash_I, optarg);
			}
			break;
		case 'v':
			/* set version filename */
			if (vflag != 0) {
				errlog(ERROR, "Error: Multiple -v options "
				    "in command line\n");
				usage();
			}
			T_info.ti_versfile = optarg;
			++vflag;
			break;
		case 'o':
			/* set name of output file */
			T_info.ti_output_file = optarg;
			break;
		case 'p':
			/* set picky flag */
			T_info.ti_flags = T_info.ti_flags | XLATOR_PICKY_FLAG;
			break;
		case '?':
		default:
			usage();
		}
	}

	if (lflag == 0) {
		errlog(ERROR,
		    "Error: -l library argument must be specified\n");
		usage();
	}
	if (aflag == 0) {
		errlog(ERROR, "Error: -a i386|sparc|sparcv9|ia64|amd64 "
			"argument must be specified\n");
		usage();
	}

	if (optind < argc) {
		filelist = &argv[optind];
	} else {
		filelist = NULL;
		errlog(ERROR, "Error: Must specify at least one spec "
			"file to process\n");
		usage();
	}

	T_info.ti_nfiles = argc-optind;
	seterrseverity(T_info.ti_verbosity);

	if (T_info.ti_dash_I == NULL) {
		T_info.ti_dash_I = ".";
	} else {
		(void) strcat(T_info.ti_dash_I, ":.");
	}

	errlog(STATUS, "using %s for spec path\n", T_info.ti_dash_I);

	if ((retval = frontend(&T_info)) != 0) {
		errlog(ERROR, "%d Error(s) occurred\n", retval);
		return (1);
	}
	return (0);
}
Ejemplo n.º 9
0
// translated to utf8_main
int main(int argc, char *argv[])
{
	int res = 0;

#if defined(SDLMAME_X11) && !(SDLMAME_SDL2)
	XInitThreads();
#endif

#if defined(SDLMAME_WIN32)
#if !(SDLMAME_SDL2)
	/* Load SDL dynamic link library */
	if ( SDL_Init(SDL_INIT_NOPARACHUTE) < 0 ) {
		fprintf(stderr, "WinMain() error: %s", SDL_GetError());
		return(FALSE);
	}
	SDL_SetModuleHandle(GetModuleHandle(NULL));
#endif
#endif

	// disable I/O buffering
	setvbuf(stdout, (char *) NULL, _IONBF, 0);
	setvbuf(stderr, (char *) NULL, _IONBF, 0);

	// FIXME: this should be done differently

#ifdef SDLMAME_UNIX
	sdl_entered_debugger = 0;
#if (!defined(SDLMAME_MACOSX)) && (!defined(SDLMAME_HAIKU)) && (!defined(SDLMAME_EMSCRIPTEN))
	FcInit();
#endif
#endif

#ifdef SDLMAME_OS2
	MorphToPM();
#endif

#if defined(SDLMAME_X11) && (SDL_MAJOR_VERSION == 1) && (SDL_MINOR_VERSION == 2)
	if (SDL_Linked_Version()->patch < 10)
	/* workaround for SDL choosing a 32-bit ARGB visual */
	{
		Display *display;
		if ((display = XOpenDisplay(NULL)) && (DefaultDepth(display, DefaultScreen(display)) >= 24))
		{
			XVisualInfo vi;
			char buf[130];
			if (XMatchVisualInfo(display, DefaultScreen(display), 24, TrueColor, &vi)) {
				snprintf(buf, sizeof(buf), "0x%lx", vi.visualid);
				osd_setenv(SDLENV_VISUALID, buf, 0);
			}
		}
		if (display)
			XCloseDisplay(display);
	}
#endif

	{
		sdl_options options;
		sdl_osd_interface osd(options);
		osd.register_options();
		cli_frontend frontend(options, osd);
		res = frontend.execute(argc, argv);
	}

#ifdef SDLMAME_UNIX
#if (!defined(SDLMAME_MACOSX)) && (!defined(SDLMAME_HAIKU)) && (!defined(SDLMAME_EMSCRIPTEN))
	if (!sdl_entered_debugger)
	{
		FcFini();
	}
#endif
#endif

	exit(res);
}
Ejemplo n.º 10
0
int main(int argc, char* argv[])
{
  unsigned int frequency = 0, adapter = 0;
  boost::filesystem::path directory;
  bool dvbv5 = false;
  {
    boost::program_options::options_description descriptions("Allowed options");
    descriptions.add_options()
      ("help", "produce this help message")
      ("directory", boost::program_options::value<std::string>(), "Directory to download DSMCC to")
      ("frequency", boost::program_options::value<unsigned int>(), "Frequency of channel")
      ("adapter", boost::program_options::value<unsigned int>(), "Adapter number")
      ("dvbv5", boost::program_options::value<bool>(), "If should use DVBv5 for frontend (default: use dvbv3)")
      ;

    boost::program_options::variables_map vm;
    boost::program_options::store(boost::program_options::parse_command_line(argc, argv, descriptions), vm);
    boost::program_options::notify(vm);
      
    if(vm.count("help") > 0)
    {
      std::cout << descriptions << std::endl;
      return 1;
    }
    if(!vm.count("frequency"))
    {
      std::cout << "You must specify the frequency (e.g. 599142857)" << std::endl;
      return 1;
    }
    if(!vm.count("directory"))
    {
      std::cout << "You must specify a directory to download the DSMCC to" << std::endl;
      return 1;
    }

    directory = vm["directory"].as<std::string>();
    if(!boost::filesystem::exists(directory))
    {
      std::cout << "Path " << directory << " doesn't exist" << std::endl;
      return 1;
    }
    frequency = vm["frequency"].as<unsigned int>();

    if(vm.count("adapter"))
    {
      adapter = vm["adapter"].as<unsigned int>();
    }

    if(vm.count("dvbv5") && vm["dvbv5"].as<bool>())
      dvbv5 = true;
  }  

  std::cout << "Opening /dev/dvb/adapter" << adapter << "/frontend0" << std::endl;
  std::string adapter_devname;
  {
    std::stringstream s;
    s << "/dev/dvb/adapter" << adapter;
    adapter_devname = s.str();
  }
  int frontend_fd = 0;
  {
    const std::string frontend_devname = adapter_devname + "/frontend0";
    frontend_fd = open(frontend_devname.c_str(), O_RDWR);
    if(frontend_fd < 0)
    {
      std::cout << "Couldn't open frontend device " << frontend_devname << " for reading and writing" << std::endl;
      return -1;
    }
  }

  try
  {
    dfd::frontend frontend (frontend_fd);
    if(dvbv5)
      frontend.tune_dvb5(frequency);
    else
      frontend.tune_dvb3(frequency);

    dfd::programs programs;
    dfd::carousels carousels;

    dfd::filters filters(adapter_devname + "/demux0");
    {
      dfd::filters::table_filter pat(0);
      filters.add_table_filter(pat, boost::bind(&dfd::parsers::pat, _1, _2, _3, boost::ref(filters)
                                                , boost::ref(programs), boost::ref(carousels))
                               , DMX_IMMEDIATE_START|DMX_ONESHOT|DMX_CHECK_CRC);
    }

    filters.run();

    std::cout << "Finished. Carousels: " << carousels.carousels_.size() << std::endl;
    unsigned int files = 0, directories = 0;
    for(std::map<unsigned int, dfd::carousel>::const_iterator
          first = carousels.carousels_.begin()
          , last = carousels.carousels_.end()
          ; first != last;++first)
    {
      files += first->second.file_objects.size();
      directories += first->second.directory_objects.size();
    }
    std::cout << "Files: " << files << " directories: " << directories << std::endl;

    directories = 0;
    for(std::map<unsigned int, dfd::carousel>::const_iterator
          first = carousels.carousels_.begin()
          , last = carousels.carousels_.end()
          ;first != last;++first)
    {
      std::stringstream s;
      s << "directory" << directories;
      boost::filesystem::path child_directory = directory / s.str();
      boost::filesystem::create_directory(child_directory);
      dfd::directory_object const& gateway = first->second.gateway;
      save_directory(child_directory, gateway, carousels);
    }
  }
  catch(std::exception const& e)
  {
    std::cout << "Exception caught " << e.what() << std::endl;
  }
}
Ejemplo n.º 11
0
int main(int argc,char** argv) {
	SgProject* proj = frontend(argc,argv);
	fixAllPrefixPostfix(proj);
	initializeScopeInformation(proj);	
	SgFunctionDeclaration* mainDecl = SageInterface::findMain(proj);

	SgFunctionDefinition* mainDef = mainDecl->get_definition();
	
	//SageInterface::rebuildSymbolTable(mainDef);
	StaticCFG::CFG cfg(mainDef);
	SgIncidenceDirectedGraph *g = cfg.getGraph();
	PathCollector* pathCollector = new PathCollector(g,&cfg);	

	std::vector<SgNode*> scopeNodes = NodeQuery::querySubTree(mainDef,V_SgScopeStatement);
	
	std::vector<SgGraphNode*> visited;
	std::vector<SgNode*> nodes = NodeQuery::querySubTree(mainDef,V_SgWhileStmt);
	std::vector<SgNode*>::iterator node = nodes.begin();
	for (; node != nodes.end(); node++) {
	SgScopeStatement* scopeOfWhile = SageInterface::getEnclosingScope(*node);
	SgStatementPtrList statementsInScope = scopeOfWhile->getStatementList();
	SgStatementPtrList::iterator statPtr = statementsInScope.begin();
	std::set<SgPragmaDeclaration*> prdecls;

	for (; statPtr!=statementsInScope.end();statPtr++) {
		if (isSgPragmaDeclaration(*statPtr)) {
			prdecls.insert(isSgPragmaDeclaration(*statPtr));
		}
	}
	//SgExprStatement* boundingConditionStatement = isSgExprStatement(isSgWhileStmt(*node)->get_condition()); 	
	//SgExpression* boundingCondition = boundingConditionStatement->get_expression();
	SgStatement* body = (isSgWhileStmt(*node)->get_body());
	std::vector<std::vector<SgGraphNode*> > paths = pathCollector->getPaths();

	
	std::cout << getPrelude() << std::endl;

		

	SgGraphNode* whileStart = cfg.cfgForBeginning(isSgWhileStmt(*node));		
	SgGraphNode* whileEnd = cfg.cfgForEnd(isSgWhileStmt(*node));
	collectPaths(whileStart,whileEnd, pathCollector);
	SgGraphNode* whileOut = getWhileEndNode(isSgWhileStmt(*node),pathCollector);
	SgGraphNode* bodyStart = cfg.cfgForBeginning(isSgWhileStmt(*node)->get_body());
	SgGraphNode* bodyEnd = cfg.cfgForEnd(isSgWhileStmt(*node)->get_body());

        pathCollector->clearPaths();
	
	collectPaths(bodyStart,whileOut,pathCollector);	
	paths.clear();
	paths = pathCollector->getPaths();
	std::vector<std::vector<SgGraphNode*> >::iterator i  = paths.begin();
	std::set<SgVariableSymbol*> vars = getVars(pathCollector);
	std::string vardecls;
	std::string initrule;
	std::vector<std::string> rules= getRules(*node,pathCollector, vars, vardecls,initrule);
	std::cout << vardecls << std::endl;
	for (int i = 0; i < rules.size(); i++) {
		std::cout << rules[i] << std::endl;
	}
	std::set<SgPragmaDeclaration*>::iterator pr = prdecls.begin();
	for (; pr != prdecls.end(); pr++) {
		std::set<std::string> variables;
		std::vector<std::string> s_expressions;
		std::string prag_str = get_pragma_string(*pr);
		bool initPrag;
		/*std::string rhs =*/ translateToS_Expr(prag_str,variables,s_expressions,initPrag);
		if (s_expressions.size() > 0) {
		std::string queryResult;
		if (initPrag) {
			queryResult = assumptionPragma(s_expressions,initrule);
		}
		else {
			queryResult = queryPragma(s_expressions,initrule);
		}	
		std::cout << queryResult << std::endl;
		}
	}
	}
	backend(proj);
	return 0;
	}
Ejemplo n.º 12
0
int
main ( int argc, char* argv[] )
   {
  // Main Function for default example ROSE Preprocessor
  // This is an example of a preprocessor that can be built with ROSE
  // This example can be used to test the ROSE infrastructure

#if 1
     list<string> l = CommandlineProcessing::generateArgListFromArgcArgv (argc,argv);
     printf ("Preprocessor (before): argv = \n%s \n",StringUtility::listToString(l).c_str());

  // testing removeArgs
     CommandlineProcessing::removeArgs (argc,argv,"-edg:");
     CommandlineProcessing::removeArgs (argc,argv,"--edg:");
     CommandlineProcessing::removeArgsWithParameters (argc,argv,"-edg_parameter:");
     CommandlineProcessing::removeArgsWithParameters (argc,argv,"--edg_parameter:");

     printf ("argc = %d \n",argc);
     l = CommandlineProcessing::generateArgListFromArgcArgv (argc,argv);
     printf ("l.size() = %d \n",l.size());
     printf ("Preprocessor (after): argv = \n%s \n",StringUtility::listToString(l).c_str());

  // printf ("Exiting in main! \n");
  // ROSE_ASSERT(1 == 2);
#endif

#if 0
     int modifiedArgc    = 0;
     char** modifiedArgv = NULL;

  // resets modifiedArgc and allocates memory to modifiedArgv
  // list<string> edgOptionWithNameParameterList = 
  //      CommandlineProcessing::generateOptionWithNameParameterList (argc, argv,"-edg_parameter:",modifiedArgc,modifiedArgv);

  // resets modifiedArgc and allocates memory to modifiedArgv
     list<string> edgOptionWithNumberParameterList =
          CommandlineProcessing::generateOptionWithNameParameterList (argc, argv,"-edg_parameter:",modifiedArgc,modifiedArgv);

     l = CommandlineProcessing::generateArgListFromArgcArgv (modifiedArgc,modifiedArgv);
     printf ("Preprocessor (after): argv = \n%s \n",StringUtility::listToString(l).c_str());

  // resets modifiedArgc to zero and releases memory from modifiedArgv (resets modifiedArgv to NULL)
     CommandlineProcessing::releaseArgListMemory(modifiedArgc,modifiedArgv);
#endif

#if 0
     if ( CommandlineProcessing::isOption(argc,argv,"-rose:","(h|help)",true) ||
          CommandlineProcessing::isOption(argc,argv,"-", "(h|help)",true) ||
          CommandlineProcessing::isOption(argc,argv,"--","(h|help)",true) )
        {
          printf ("\nROSE (pre-release alpha version: %s) \n",VERSION);
          ROSE::usage(0);
          exit(0);
        }

     l = CommandlineProcessing::generateArgListFromArgcArgv (argc,argv);
     printf ("Preprocessor (after): argv = \n%s \n",StringUtility::listToString(l).c_str());

     printf ("Exiting after initial command line processing \n");
     ROSE_ABORT();
#endif

#if 0
     string stringParameter;
     if ( CommandlineProcessing::isOptionWithParameter(argc,argv,"-rose:","(o|output)",stringParameter,true) )
        {
          printf ("-rose:output %s \n",stringParameter.c_str());
       // Make our own copy of the filename string
          int length = stringParameter.length();
          char* p_unparse_output_filename = (char*) new char[length+1];
          ROSE_ASSERT (p_unparse_output_filename != NULL);
          stringParameter.copy(p_unparse_output_filename,length,0);
          p_unparse_output_filename[length] = '\0';
          printf ("p_unparse_output_filename = %s \n",p_unparse_output_filename);
        }
       else
        {
          printf ("-rose:output not set! \n");
        }
#endif


#if 0
     int modifiedArgc    = 0;
     char** modifiedArgv = NULL;

  // resets modifiedArgc and allocates memory to modifiedArgv
     list<string> edgOptionList = CommandlineProcessing::generateOptionList (argc, argv,"-edg:",modifiedArgc,modifiedArgv);

  // resets modifiedArgc to zero and releases memory from modifiedArgv (resets modifiedArgv to NULL)
     CommandlineProcessing::releaseArgListMemory(modifiedArgc,modifiedArgv);

     if ( CommandlineProcessing::isOption(argc,argv,"-","help",true) )
        {
          printf ("Option -help found! \n");
        }

     if ( CommandlineProcessing::isOption(argc,argv,"--","help",true) )
        {
          printf ("Option --help found! \n");
        }

     int integerParameter;
     if ( CommandlineProcessing::isOptionWithParameter(argc,argv,"-edg:","test",integerParameter,true) )
        {
          printf ("Option (integer parameter) -test %d found! \n",integerParameter);
        }

     string stringParameter;
     if ( CommandlineProcessing::isOptionWithParameter(argc,argv,"-edg:","test",stringParameter,true) )
        {
          printf ("Option (string parameter) -test %s found! \n",stringParameter.c_str());
        }
#endif

     SgProject* project = frontend(argc,argv);
     ROSE_ASSERT (project != NULL);

#if 0
  // See if we can access the EDG AST directly
     ROSE_ASSERT (il_header.primary_source_file != NULL);
     ROSE_ASSERT (il_header.primary_source_file->file_name != NULL);
     printf ("##### il_header.primary_source_file->file_name = %s \n",il_header.primary_source_file->file_name);
#endif

  // DQ (2/6/2004): These tests fail in Coco for test2004_14.C
  // AstTests::runAllTests(const_cast<SgProject*>(project));

  // printf ("Generate the pdf output of the SAGE III AST \n");
  // generatePDF ( project );

     printf ("Generate the DOT output of the SAGE III AST \n");
     generateDOT ( *project );

     return backend(project);

  // alternative form
  // return backend(frontend(argc,argv));
   }
Ejemplo n.º 13
0
int emulator_info::start_frontend(emu_options &options, osd_interface &osd, int argc, char *argv[])
{
	cli_frontend frontend(options, osd);
	return frontend.execute(argc, argv);
}
Ejemplo n.º 14
0
 void start()
 {
     QScriptDebuggerCommandSchedulerFrontend frontend(commandScheduler(), this);
     frontend.scheduleGetCompletions(m_frameIndex, m_path);
 }
Ejemplo n.º 15
0
int QScriptDebuggerConsoleGlobalObject::scheduleRunToLocation(const QString &fileName, int lineNumber)
{
    Q_D(QScriptDebuggerConsoleGlobalObject);
    QScriptDebuggerCommandSchedulerFrontend frontend(d->scheduler, d->responseHandler);
    return frontend.scheduleRunToLocation(fileName, lineNumber);
}
Ejemplo n.º 16
0
void InspectorAnimationAgent::didCreateAnimation(unsigned sequenceNumber) {
  if (m_isCloning)
    return;
  frontend()->animationCreated(String::number(sequenceNumber));
}
Ejemplo n.º 17
0
int QScriptDebuggerConsoleGlobalObject::scheduleRunToLocation(qint64 scriptId, int lineNumber)
{
    Q_D(QScriptDebuggerConsoleGlobalObject);
    QScriptDebuggerCommandSchedulerFrontend frontend(d->scheduler, d->responseHandler);
    return frontend.scheduleRunToLocation(scriptId, lineNumber);
}
void InspectorApplicationCacheAgent::enable(ErrorString*)
{
    m_state->setBoolean(ApplicationCacheAgentState::applicationCacheAgentEnabled, true);
    m_instrumentingAgents->setInspectorApplicationCacheAgent(this);
    frontend()->networkStateUpdated(networkStateNotifier().onLine());
}
Ejemplo n.º 19
0
int QScriptDebuggerConsoleGlobalObject::scheduleDeleteAllBreakpoints()
{
    Q_D(QScriptDebuggerConsoleGlobalObject);
    QScriptDebuggerCommandSchedulerFrontend frontend(d->scheduler, d->responseHandler);
    return frontend.scheduleDeleteAllBreakpoints();
}
void InspectorApplicationCacheAgent::networkStateChanged(LocalFrame* frame, bool online)
{
    if (frame == m_inspectedFrames->root())
        frontend()->networkStateUpdated(online);
}
Ejemplo n.º 21
0
int QScriptDebuggerConsoleGlobalObject::scheduleGetScriptData(qint64 id)
{
    Q_D(QScriptDebuggerConsoleGlobalObject);
    QScriptDebuggerCommandSchedulerFrontend frontend(d->scheduler, d->responseHandler);
    return frontend.scheduleGetScriptData(id);
}
Ejemplo n.º 22
0
Archivo: main.C Proyecto: 8l/rose
int main(int argc, char **argv)
{

  /* parse the command line and extract analyzer options */
  CommandLineParser clp;
  AnalyzerOptions opt=clp.parse(argc,argv);

  /* set the PAG options as specified on the command line */
  setPagOptions(opt);
  
  /* Run the frontend to construct an abstract syntax tree from
   * the files specified on the command line (which has been processed
   * and commands only relevant to the analyzer have been removed). */
  SgProject* ast_root = frontend(opt.getCommandLineNum(), opt.getCommandLineCarray());
  
  /* Make sure everything is OK... */
  AstTests::runAllTests(ast_root);

  /* Construct a control-flow graph from the AST, make sure it has
   * the structrure expected by PAG, and run the analysis on it,
   * attributing the statements of the AST with analysis
   * information. Use the StatementAttributeTraversal class for accessing
   * the analysis information on each statement */
  char* outputfile=(char*)opt.getGdlFileName().c_str();
  DFI_STORE analysis_info = perform_pag_analysis(ANALYSIS)(ast_root,outputfile,!opt.animationGeneration());

  /* Handle command line option --textoutput */
  if(opt.analysisResultsTextOutput()) {
    PagDfiTextPrinter<DFI_STORE> p(analysis_info);
    p.traverseInputFiles(ast_root, preorder);
  }
  
  /* Handle command line option --sourceoutput 
   * The source code (i.e. the AST) is annotated with comments showing
   * the analysis results and by calling the backend an annotated C/C++
   * file is generated (named rose_<inputfilename>) */
  if(opt.analysisResultsSourceOutput()) {
    PagDfiCommentAnnotator<DFI_STORE> ca(analysis_info);
    ca.traverseInputFiles(ast_root, preorder);
    ast_root->unparse();
  }

  /* Free all memory allocated by the PAG garbage collection */
  GC_finish();
  
  return 0;

  /*
  debug_stat=1; // 1 or 2 for debugging, 2 means more detailed stats
  verbose=0; // prints PAG-info during analysis (see section 14.3.3.1 in User Manual)

  animation="anim-out";
    SgProject *root = frontend(argc, argv);
    AstTests::runAllTests(root);
    std::cout << "collecting functions... ";
    ProcTraversal s;
    s.traverseInputFiles(root, preorder);
    std::cout << "done" << std::endl;

    std::cout << "generating cfg... ";
    CFGTraversal t(s.get_procedures());
    t.traverseInputFiles(root, preorder);
    std::cout << "done" << std::endl;

    std::cout << "testing cfg... " << std::endl;
    int test_result = kfg_testit(t.getCFG(), 0, "cfg_dump.gdl");
    if (test_result == 0)
    {
        std::cout << std::endl
            << "Warning: There are problems in the CFG."
            << std::endl
            << "Do not rely on the analysis results." << std::endl;
    }
    else
        std::cout << "no problems found" << std::endl;

    std::cout << "performing analysis " str(ANALYSIS) "... ";
    doit(ANALYSIS)(t.getCFG());
    std::cout << "done" << std::endl;
    std::cout << "generating visualization... ";
    gdl_create(str(ANALYSIS) "_result.gdl", 0);
    std::cout << "done" << std::endl;

    return 0;
  */
}
Ejemplo n.º 23
0
int QScriptDebuggerConsoleGlobalObject::scheduleGetBacktrace()
{
    Q_D(QScriptDebuggerConsoleGlobalObject);
    QScriptDebuggerCommandSchedulerFrontend frontend(d->scheduler, d->responseHandler);
    return frontend.scheduleGetBacktrace();
}
Ejemplo n.º 24
0
void QScriptDebuggerLocalsModelPrivate::deleteObjectSnapshots(const QList<qint64> &snapshotIds)
{
    QScriptDebuggerCommandSchedulerFrontend frontend(commandScheduler, 0);
    for (int i = 0; i < snapshotIds.size(); ++i)
        frontend.scheduleDeleteScriptObjectSnapshot(snapshotIds.at(i));
}
Ejemplo n.º 25
0
int QScriptDebuggerConsoleGlobalObject::scheduleNewScriptValueIterator(const QScriptDebuggerValue &object)
{
    Q_D(QScriptDebuggerConsoleGlobalObject);
    QScriptDebuggerCommandSchedulerFrontend frontend(d->scheduler, d->responseHandler);
    return frontend.scheduleNewScriptValueIterator(object);
}
Ejemplo n.º 26
0
void InspectorWorkerAgent::dispatchMessageFromWorker(WorkerInspectorProxy* proxy, const String& message)
{
    frontend()->dispatchMessageFromWorker(proxy->inspectorId(), message);
}
Ejemplo n.º 27
0
int QScriptDebuggerConsoleGlobalObject::scheduleDeleteScriptValueIterator(int id)
{
    Q_D(QScriptDebuggerConsoleGlobalObject);
    QScriptDebuggerCommandSchedulerFrontend frontend(d->scheduler, d->responseHandler);
    return frontend.scheduleDeleteScriptValueIterator(id);
}
Ejemplo n.º 28
0
int QScriptDebuggerConsoleGlobalObject::scheduleStepOver(int count)
{
    Q_D(QScriptDebuggerConsoleGlobalObject);
    QScriptDebuggerCommandSchedulerFrontend frontend(d->scheduler, d->responseHandler);
    return frontend.scheduleStepOver(count);
}
Ejemplo n.º 29
0
int QScriptDebuggerConsoleGlobalObject::scheduleClearExceptions()
{
    Q_D(QScriptDebuggerConsoleGlobalObject);
    QScriptDebuggerCommandSchedulerFrontend frontend(d->scheduler, d->responseHandler);
    return frontend.scheduleClearExceptions();
}
Ejemplo n.º 30
0
// arg & 1: decompile to C code (1) or normally (0)
// arg & 2: print instruction list before splitting into nodes
// arg & 4: dump current instruction
// arg & 8: process all functions
void idaapi run(int arg)
{
	msg("Running The Desquirr decompiler plugin\n");
	
	IdaPro* idapro;
	
	if (PLFM_386 == ph.id)
		idapro = new IdaX86();
	else if (PLFM_ARM == ph.id)
		idapro = new IdaArm();
	else
	{
		msg("Unexpected processor module\n");
		return;
	}
	
	Frontend_ptr frontend(idapro);
	Frontend::Set(frontend);

	if (arg & 4)
	{
		idapro->DumpInsn(get_screen_ea());
		return;
	}
	CodeStyle style = (arg & 1) ? C_STYLE : LISTING_STYLE;
	
	for (func_t *function= (arg&8)?get_next_func(0) : get_func(get_screen_ea()) ; function ; function= (arg&8)?get_next_func(function->startEA):0)
	{
		if (function->flags & FUNC_LIB)
			msg("Warning: Library function\n");
		
		Instruction_list instructions;

		msg("-> Creating instruction list\n");
		idapro->FillList(function, instructions);

		if (arg & 2)
		{
			msg("Instruction list:\n");
			GenerateCode(instructions, style);
			break;
		}

		Node_list nodes;
		msg("-> Creating node list\n");
		Node::CreateList(instructions, nodes);
        //if (g_bDumpNodeContents) DumpList(nodes);
		msg("-> Update uses and definitions\n");
		UpdateUsesAndDefinitions(nodes);
        //if (g_bDumpNodeContents) DumpList(nodes);
		msg("-> Live register analysis\n");
		Node::LiveRegisterAnalysis(nodes);
        //if (g_bDumpNodeContents) DumpList(nodes);
		msg("-> Finding DU chains\n");
		Node::FindDefintionUseChains(nodes);
        if (g_bDumpNodeContents) DumpList(nodes);
		
		msg("-> Data flow analysis\n");
		{
			DataFlowAnalysis analysis(nodes);
			analysis.AnalyzeNodeList();
			// want destructor to run here :-)
		}
        if (g_bDumpNodeContents) DumpList(nodes);

		msg("Basic block list:\n");
		GenerateCode(nodes, style);

	}
}