Package ghidra.program.model.pcode
Class PcodeBlock
java.lang.Object
ghidra.program.model.pcode.PcodeBlock
- Direct Known Subclasses:
BlockCopy,BlockGraph,PcodeBlockBasic
Blocks of PcodeOps
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddInEdge(PcodeBlock b, int lab) intcalcDepth(PcodeBlock leaf) voidDecode this block from a streamprotected voiddecodeBody(Decoder decoder, BlockMap resolver) Restore the any additional information beyond header and edges from streamprotected voiddecodeEdges(Decoder decoder, BlockMap resolver) protected voiddecodeHeader(Decoder decoder) protected voiddecodeNextInEdge(Decoder decoder, BlockMap resolver) Decode the next input edge from the streamprotected voiddecodeNextInEdge(Decoder decoder, ArrayList<? extends PcodeBlock> blockList) Decode the next input edge from the stream.voidEncode this block to a streamprotected voidencodeBody(Encoder encoder) Encode information about the block to stream, other than header and edge infoprotected voidencodeEdges(Encoder encoder) Encode information about this blocks edges to streamprotected voidencodeHeader(Encoder encoder) Encode basic attributes to stream.Assuming paths out of this block depend on a boolean conditiongetIn(int i) intgetIndex()intgetInRevIndex(int i) Get reverse index of the i-th incoming block.intgetOut(int i) intgetOutRevIndex(int i) Get reverse index of the i-th outgoing block.intgetStart()getStop()Assuming paths out of this block depend on a boolean conditionintgetType()static intnameToType(String name) voidsetIndex(int i) toString()static StringtypeToName(int type)
-
Field Details
-
PLAIN
public static final int PLAIN- See Also:
-
BASIC
public static final int BASIC- See Also:
-
GRAPH
public static final int GRAPH- See Also:
-
COPY
public static final int COPY- See Also:
-
GOTO
public static final int GOTO- See Also:
-
MULTIGOTO
public static final int MULTIGOTO- See Also:
-
LIST
public static final int LIST- See Also:
-
CONDITION
public static final int CONDITION- See Also:
-
PROPERIF
public static final int PROPERIF- See Also:
-
IFELSE
public static final int IFELSE- See Also:
-
IFGOTO
public static final int IFGOTO- See Also:
-
WHILEDO
public static final int WHILEDO- See Also:
-
DOWHILE
public static final int DOWHILE- See Also:
-
SWITCH
public static final int SWITCH- See Also:
-
INFLOOP
public static final int INFLOOP- See Also:
-
-
Constructor Details
-
PcodeBlock
public PcodeBlock()
-
-
Method Details
-
typeToName
-
nameToType
-
toString
-
getType
public int getType() -
getStart
- Returns:
- the first Address covered by this block
-
getStop
- Returns:
- the last Address covered by this block
-
setIndex
public void setIndex(int i) -
getIndex
public int getIndex() -
getParent
-
addInEdge
-
decodeNextInEdge
Decode the next input edge from the stream- Parameters:
decoder- is the stream decoderresolver- is used to find PcodeBlocks- Throws:
DecoderException- for any invalid encoding
-
decodeNextInEdge
protected void decodeNextInEdge(Decoder decoder, ArrayList<? extends PcodeBlock> blockList) throws DecoderException Decode the next input edge from the stream. Resolve block indices via a blockList- Parameters:
decoder- is the stream decoderblockList- allows lookup of PcodeBlock via index- Throws:
DecoderException- for any invalid encoding
-
getIn
-
getOut
-
getOutRevIndex
public int getOutRevIndex(int i) Get reverse index of the i-th outgoing block. I.e this.getOut(i).getIn(reverse_index) == this- Parameters:
i- is the outgoing block to request reverse index from- Returns:
- the reverse index
-
getInRevIndex
public int getInRevIndex(int i) Get reverse index of the i-th incoming block. I.e. this.getIn(i).getOut(reverse_index) == this- Parameters:
i- is the incoming block to request reverse index from- Returns:
- the reverse index
-
getFalseOut
Assuming paths out of this block depend on a boolean condition- Returns:
- the PcodeBlock coming out of this if the condition is false
-
getTrueOut
Assuming paths out of this block depend on a boolean condition- Returns:
- the PcodeBlock coming out of this if the condition is true
-
getInSize
public int getInSize() -
getOutSize
public int getOutSize() -
calcDepth
-
getFrontLeaf
-
encodeHeader
Encode basic attributes to stream. Assume this block's element is already started.- Parameters:
encoder- is the stream encoder- Throws:
IOException- for errors writing to the underlying stream
-
decodeHeader
- Throws:
DecoderException
-
encodeBody
Encode information about the block to stream, other than header and edge info- Parameters:
encoder- is the stream encoder- Throws:
IOException- for errors writing to the underlying stream
-
encodeEdges
Encode information about this blocks edges to stream- Parameters:
encoder- is the stream encoder- Throws:
IOException- for errors writing to the underlying stream
-
decodeBody
Restore the any additional information beyond header and edges from stream- Parameters:
decoder- is the stream decoderresolver- is for looking up edge references- Throws:
DecoderException- for invalid encoding
-
decodeEdges
- Throws:
DecoderException
-
encode
Encode this block to a stream- Parameters:
encoder- is the stream encoder- Throws:
IOException- for errors writing to the underlying stream
-
decode
Decode this block from a stream- Parameters:
decoder- is the stream decoderresolver- is the map from reference to block object- Throws:
DecoderException- for errors in the encoding
-