Examples of InstrumentorChain


Examples of alt.jiapi.InstrumentorChain

        if (chainSpecs.length == 0) {
            throw new JiapiException("Empty chainSpec");
        }

        ChainBuilder cb = new ChainBuilder();
        InstrumentorChain chain = cb.createChain(chainSpecs[0]);
        InstrumentationDescriptor id = new InstrumentationDescriptor();
        addInclusionRules(id, getInclusionRules());
        addExclusionRules(id, getExclusionRules());

        for (int i = 1; i < chainSpecs.length; i++) {
View Full Code Here

Examples of alt.jiapi.InstrumentorChain

        MCITest mci = new MCITest();
        mci.run(args);
    }

    public MCITest() throws JiapiException {
        InstrumentorChain chain = new InstrumentorChain();

        Instrumentor dispatcher = new MethodDispatcherInstrumentor();
        Instrumentor si = new GrepInstrumentor(new MethodCallStrategy());
        TailInstrumentor after = new TailInstrumentor();
        MethodCallInstrumentor mci = new MethodCallInstrumentor(this);

        chain.add(dispatcher);
        chain.add(si);     // Split (method call)
        chain.add(after)// BEFORE, AFTER or AROUND
        chain.add(mci);    // make a method call

        InstrumentationDescriptor id = new InstrumentationDescriptor();
        addInclusionRules(id, getInclusionRules());
        addExclusionRules(id, getExclusionRules());
        id.addChain(chain);
View Full Code Here

Examples of alt.jiapi.instrumentor.InstrumentorChain

     */
    public static void main(String [] args) throws Exception {
        SymbolMap map = new SymbolMap("alt.jiapi.instrumentor");

        ChainBuilder cb = new ChainBuilder(map);
        InstrumentorChain chain = cb.createChain(args[0]);
        System.out.println(chain);
    }
View Full Code Here

Examples of alt.jiapi.instrumentor.InstrumentorChain

    /**
     * Creates a chain from chainSpec and given SymbolMap
     */
    public InstrumentorChain createChain(String chainSpec, SymbolMap symbols) throws JiapiException, ClassNotFoundException, InstantiationException {
        InstrumentorChain chain = new InstrumentorChain();

        StringTokenizer st = new StringTokenizer(chainSpec, "|");
        while (st.hasMoreTokens()) {
            String instrumentorSpec = st.nextToken().trim();

            ChainInstrumentor i = createInstrumentor(instrumentorSpec, symbols);
            if (i == null) {
                throw new JiapiException("ChainBuilder.createInstrumentor(...) returned null");
            }

            chain.add(i);
        }

        return chain;
    }
View Full Code Here

Examples of alt.jiapi.instrumentor.InstrumentorChain

            ChainInstrumentor afterSet = new TailInstrumentor();
            ChainInstrumentor callFieldSet =
                new MethodCallInstrumentor(new FieldSetHook(this));
           
            InstrumentorChain setChain = new InstrumentorChain();
            setChain.add(setDispatcher);
            setChain.add(grepWriteAccess);
            setChain.add(afterSet);
            setChain.add(callFieldSet);


            ChainInstrumentor getDispatcher = new MethodDispatcherInstrumentor();
            GrepInstrumentor grepReadAccess =
            // Following commented line fixes bug that we instrument
            // on field accesses that were synthesized by Jiapi itself.
                  new GrepInstrumentor(new FieldAccessStrategy("*__jiapi_field*", true, FieldAccessStrategy.READ_ACCESS));

            grepReadAccess.setResolutions(getResolutions());

            ChainInstrumentor beforeRead = new HeadInstrumentor();
            ChainInstrumentor callFieldGet =
                new MethodCallInstrumentor(new FieldGetHook(this));

            InstrumentorChain getChain = new InstrumentorChain();
            getChain.add(getDispatcher);
            getChain.add(grepReadAccess);
            getChain.add(beforeRead);
            getChain.add(callFieldGet);


            id.addInstrumentor(getChain);
            id.addInstrumentor(setChain);
        } catch (Exception e) {
View Full Code Here

Examples of alt.jiapi.instrumentor.InstrumentorChain

            grepEntry.setResolutions(getResolutions());

            ChainInstrumentor entryCall
                = new MethodCallInstrumentor(new MethodEntryHook(this));

            InstrumentorChain entryChain = new InstrumentorChain();
            entryChain.add(entryDispatcher);
            entryChain.add(grepEntry);
//              entryChain.add(head0);                       // ---
            entryChain.add(entryCall);


            // For method exit traps :
            ChainInstrumentor exitDispatcher = new MethodDispatcherInstrumentor();
            GrepInstrumentor grepExit
                = new GrepInstrumentor(new MethodReturnStrategy());
           
            grepExit.setResolutions(getResolutions());
           
            ChainInstrumentor head = new HeadInstrumentor();
            ChainInstrumentor exitCall =
                new MethodCallInstrumentor(new MethodExitHook(this));
           
            InstrumentorChain exitChain = new InstrumentorChain();
            exitChain.add(exitDispatcher);
            exitChain.add(grepExit);
            exitChain.add(head);
            exitChain.add(exitCall);
               
            // Add chains created
            id.addInstrumentor(entryChain);
            id.addInstrumentor(exitChain);
        }
View Full Code Here

Examples of alt.jiapi.instrumentor.InstrumentorChain

     */
    public ExceptionEventProducer(InstrumentationDescriptor id, String resolution) {
        super(resolution);

        try {
            InstrumentorChain chain = new InstrumentorChain();
            ChainInstrumentor dispatcher = new MethodDispatcherInstrumentor();
            CatchInstrumentor selectCatchBlocks = new CatchInstrumentor();
            ChainInstrumentor selectHead = new HeadInstrumentor();
            ChainInstrumentor callMethod =
                new MethodCallInstrumentor(new CatchHook(this));

            selectCatchBlocks.setResolutions(getResolutions());

            chain.add(dispatcher);
            chain.add(selectCatchBlocks);
            chain.add(selectHead);
            chain.add(callMethod);

            id.addInstrumentor(chain);
        } catch (Exception e) {
            // NOTE! Fix exception handling.
            e.printStackTrace();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.