Class InjectPayloadSleigh

    • Field Detail

      • name

        protected java.lang.String name
      • type

        protected int type
      • source

        protected java.lang.String source
    • Constructor Detail

      • InjectPayloadSleigh

        protected InjectPayloadSleigh​(ConstructTpl pcode,
                                      InjectPayloadSleigh failedPayload)
        Constructor for partial clone of another payload whose p-code failed to parse
        Parameters:
        pcode - is substitute p-code to replace the failed parse
        failedPayload - is the failed payload
      • InjectPayloadSleigh

        protected InjectPayloadSleigh​(ConstructTpl pcode,
                                      int tp,
                                      java.lang.String nm)
        Constructor for a dummy payload, given just a name
        Parameters:
        pcode - is the dummy p-code sequence
        tp - is the type of injection
        nm - is the name of the injection
      • InjectPayloadSleigh

        protected InjectPayloadSleigh​(java.lang.String sourceName)
        Constructor for use where restoreXml is overridden and provides name and type
        Parameters:
        sourceName - is string describing the source of this payload
      • InjectPayloadSleigh

        public InjectPayloadSleigh​(java.lang.String nm,
                                   int tp,
                                   java.lang.String sourceName)
        Provide basic form, restoreXml fills in the rest
        Parameters:
        nm - must provide formal name
        tp - must provide type
        sourceName - is a description of the source of this payload
    • Method Detail

      • getName

        public java.lang.String getName()
        Specified by:
        getName in interface InjectPayload
        Returns:
        formal name for this injection
      • getType

        public int getType()
        Specified by:
        getType in interface InjectPayload
        Returns:
        the type of this injection: CALLFIXUP_TYPE, CALLMECHANISM_TYPE, etc.
      • getSource

        public java.lang.String getSource()
        Specified by:
        getSource in interface InjectPayload
        Returns:
        a String describing the source of this payload
      • getParamShift

        public int getParamShift()
        Specified by:
        getParamShift in interface InjectPayload
        Returns:
        number of parameters from the original call which should be truncated
      • isErrorPlaceholder

        public boolean isErrorPlaceholder()
        Description copied from interface: InjectPayload
        If parsing a payload (from XML) fails, a placeholder payload may be substituted and this method returns true for the substitute. In all other cases, this returns false.
        Specified by:
        isErrorPlaceholder in interface InjectPayload
        Returns:
        true if this is a placeholder for a payload with parse errors.
      • inject

        public void inject​(InjectContext context,
                           PcodeEmit emit)
        Description copied from interface: InjectPayload
        Given a context, send the p-code payload to the emitter
        Specified by:
        inject in interface InjectPayload
        Parameters:
        context - is the context for injection
        emit - is the object accumulating the final p-code
      • getPcode

        public PcodeOp[] getPcode​(Program program,
                                  InjectContext con)
        Description copied from interface: InjectPayload
        A convenience function wrapping the inject method, to produce the final set of PcodeOp objects in an array
        Specified by:
        getPcode in interface InjectPayload
        Parameters:
        program - is the Program for which injection is happening
        con - is the context for injection
        Returns:
        the array of PcodeOps
      • isFallThru

        public boolean isFallThru()
        Specified by:
        isFallThru in interface InjectPayload
        Returns:
        true if the injected p-code falls thru
      • isIncidentalCopy

        public boolean isIncidentalCopy()
        Specified by:
        isIncidentalCopy in interface InjectPayload
        Returns:
        true if this inject's COPY operations should be treated as incidental
      • orderParameters

        protected void orderParameters()
        All input and output parameters must have a unique index. Order them so that inputs come first, then outputs
      • saveXml

        public void saveXml​(java.lang.StringBuilder buffer)
        Description copied from interface: InjectPayload
        Write out configuration parameters as a \ XML tag
        Specified by:
        saveXml in interface InjectPayload
        Parameters:
        buffer - is the stream to write to
      • restoreXml

        public void restoreXml​(XmlPullParser parser,
                               SleighLanguage language)
                        throws XmlParseException
        Description copied from interface: InjectPayload
        Restore the payload from an XML stream. The root expected document is the \ tag, which may be wrapped with another tag by the derived class.
        Specified by:
        restoreXml in interface InjectPayload
        Parameters:
        parser - is the XML stream
        language - is used to resolve registers and address spaces
        Throws:
        XmlParseException - for badly formed XML
      • setTemplate

        protected void setTemplate​(ConstructTpl ctl)
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • getDummyPcode

        public static ConstructTpl getDummyPcode​(AddressFactory addrFactory)
        Build a dummy p-code sequence to use in place of a normal parsed payload. A ConstructTpl is built out of Varnode and PcodeOp templates that can be assigned directly to the pcodeTemplate field of the payload. The sequence itself is non-empty, consisting of a single operation: tmp = tmp + 0;
        Parameters:
        addrFactory - is used to construct temp and constant Varnodes
        Returns:
        the final dummy template