Esempio n. 1
0
int main(int argc, char *argv[]) {
    std::vector<std::string> args(argv, argv+argc);
    for (size_t argno=1; argno<args.size(); ++argno) {
        if (0==args[argno].compare("--trace")) {
            do_trace = true;
            args[argno] = "";
        } else if (0==args[argno].compare("--no-trace")) {
            do_trace = false;
            args[argno] = "";
        } else if (0==args[argno].compare("--test-subst")) {
            do_test_subst = true;
            args[argno] = "";
        } else if (0==args[argno].compare("--no-test-subst")) {
            do_test_subst = false;
            args[argno] = "";
        } else if (0==args[argno].compare("--usedef")) {
            do_usedef = true;
            args[argno] = "";
        } else if (0==args[argno].compare("--no-usedef")) {
            do_usedef = false;
            args[argno] = "";
        }
    }
    args.erase(std::remove(args.begin(), args.end(), ""), args.end());

    SgProject *project = frontend(argc, argv);
    AnalyzeX86Functions analysis;
    analysis.traverse(project, postorder);
    if (0==analysis.ninterps) {
        std::cout <<"file(s) didn't have any 32-bit x86 headers.\n";
    } else {
        std::cout <<"analyzed headers: " <<analysis.ninterps<< "\n";
    }
    return 0;
}
Esempio n. 2
0
int main(int argc, char *argv[]) {
    std::vector<std::string> args(argv, argv+argc);
    for (size_t argno=1; argno<args.size(); ++argno) {
        if (0==args[argno].compare("--trace")) {
            do_trace = true;
            args[argno] = "";
        } else if (0==args[argno].compare("--no-trace")) {
            do_trace = false;
            args[argno] = "";
        } else if (0==args[argno].compare("--test-subst")) {
            do_test_subst = true;
            args[argno] = "";
        } else if (0==args[argno].compare("--no-test-subst")) {
            do_test_subst = false;
            args[argno] = "";
        } else if (0==args[argno].compare("--usedef")) {
            do_usedef = true;
            args[argno] = "";
        } else if (0==args[argno].compare("--no-usedef")) {
            do_usedef = false;
            args[argno] = "";
        }
    }
    args.erase(std::remove(args.begin(), args.end(), ""), args.end());

    SgProject *project = frontend(argc, argv);
    AnalyzeX86Functions analysis;
    analysis.traverse(project, postorder);
    if (0==analysis.ninterps) {
        std::cout <<"file(s) didn't have any 32-bit x86 headers.\n";
    } else {
        std::cout <<"analyzed headers: " <<analysis.ninterps<< "\n";
    }

    std::ostream &info = std::cerr; // do not include in answer because objects vary in size per architecture
    info <<"Before vacuum...\n";
    BaseSemantics::SValue::poolAllocator().showInfo(info);
    BaseSemantics::SValue::poolAllocator().vacuum();
    info <<"After vacuum...\n";
    BaseSemantics::SValue::poolAllocator().showInfo(info);

    return 0;
}