public interface

ICElement

com.pnfsoftware.jeb.core.units.code.asm.decompiler.ast.ICElement
Known Indirect Subclasses

Class Overview

Base interface for C AST elements.

Summary

Public Methods
abstract void addPhysicalOffset(Long offset)
abstract void addPhysicalOffsets(Collection<Long> offsets)
abstract ICElement duplicate()
Deep duplication of the element (i.e.
abstract Long evaluate(CMethodState state, CEnvironment environment)
abstract String format()
Generate a full-form text version of this element.
abstract void generate(COutputSink out)
Generate the visual representation of the AST element.
abstract CElementType getElementType()
This convenience method returns the type of C AST element held by this object.
abstract Long getPhysicalOffset()
Get the closest physical offset or address that matches this high-level pseudo-code element.
abstract Collection<Long> getPhysicalOffsets()
Get the physical offsets of instructions matching this AST element.
abstract List<ICElement> getSubElements()
Get the list of AST elements that constitute this AST element.
abstract boolean replaceSubElement(ICElement oldElement, ICElement newElement)
Replace one element by another one.
abstract void setPhysicalOffsets(Collection<Long> offsets)
abstract String toString()
Generate a short-form text version of this element.
abstract boolean visitDepthPost(ICVisitor visitor)
Depth-first search, post-order visit of an expression tree or sub-tree.
abstract boolean visitDepthPost(ICVisitor visitor, ICElement parent, CVisitResults results)
Depth-first search, post-order visit of an expression tree or sub-tree.
abstract boolean visitDepthPost(ICVisitor visitor, ICElement parent)
Depth-first search, post-order visit of an expression tree or sub-tree.

Public Methods

public abstract void addPhysicalOffset (Long offset)

public abstract void addPhysicalOffsets (Collection<Long> offsets)

public abstract ICElement duplicate ()

Deep duplication of the element (i.e. sub-elements are duplicated).

Note: ICClass, ICMethod, ICField, ICIdentifier, ICConstant, ICType and ICLabel are not duplicated.

public abstract Long evaluate (CMethodState state, CEnvironment environment)

Parameters
state input state, can be updated
Returns
  • evaluation result if any, can be null

public abstract String format ()

Generate a full-form text version of this element.

public abstract void generate (COutputSink out)

Generate the visual representation of the AST element. The output is directed into a sink, that represents the current output state for the whole AST. Every AST statement must implement this method.

Parameters
out where the AST element should be generated; the sink also contains attributes indicating how the element should be generated.

public abstract CElementType getElementType ()

This convenience method returns the type of C AST element held by this object.

public abstract Long getPhysicalOffset ()

Get the closest physical offset or address that matches this high-level pseudo-code element.

Returns
  • an offset/address, null if none

public abstract Collection<Long> getPhysicalOffsets ()

Get the physical offsets of instructions matching this AST element.

public abstract List<ICElement> getSubElements ()

Get the list of AST elements that constitute this AST element. Typically, for simple statements, it may be expression. For complex expressions, it may be simpler expressions. For compound statements, it may more statements and expressions. Etc.

Be careful to manage properly possible infinite loops (in particular on recursive calls, when sub element may be the current method). Use isClassMethodField(ICElement) to avoid infinite recursing or visitDepthPost(ICVisitor) methods.

Returns
  • the list of constituting elements, may be empty but never null

public abstract boolean replaceSubElement (ICElement oldElement, ICElement newElement)

Replace one element by another one. Only the references are compared, no equals/deep compare. At most one element is replaced.

Parameters
oldElement the element to be replaced
newElement the new element

public abstract void setPhysicalOffsets (Collection<Long> offsets)

public abstract String toString ()

Generate a short-form text version of this element.

public abstract boolean visitDepthPost (ICVisitor visitor)

Depth-first search, post-order visit of an expression tree or sub-tree. The node being visited may be replaced without notifying the visitor.

Parameters
visitor the visitor object
Returns
  • true if the visit was successful

public abstract boolean visitDepthPost (ICVisitor visitor, ICElement parent, CVisitResults results)

Depth-first search, post-order visit of an expression tree or sub-tree. The node being visited may be replaced without notifying the visitor.

Parameters
visitor the visitor object
Returns
  • true if the visit was successful

public abstract boolean visitDepthPost (ICVisitor visitor, ICElement parent)

Depth-first search, post-order visit of an expression tree or sub-tree. The node being visited may be replaced without notifying the visitor.

Parameters
visitor the visitor object
Returns
  • true if the visit was successful