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
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
addInEdge
(PcodeBlock b, int lab) int
calcDepth
(PcodeBlock leaf) void
Decode this block from a streamprotected void
decodeBody
(Decoder decoder, BlockMap resolver) Restore the any additional information beyond header and edges from streamprotected void
decodeEdges
(Decoder decoder, BlockMap resolver) protected void
decodeHeader
(Decoder decoder) protected void
decodeNextInEdge
(Decoder decoder, BlockMap resolver) Decode the next input edge from the streamprotected void
decodeNextInEdge
(Decoder decoder, ArrayList<? extends PcodeBlock> blockList) Decode the next input edge from the stream.void
Encode this block to a streamprotected void
encodeBody
(Encoder encoder) Encode information about the block to stream, other than header and edge infoprotected void
encodeEdges
(Encoder encoder) Encode information about this blocks edges to streamprotected void
encodeHeader
(Encoder encoder) Encode basic attributes to stream.Assuming paths out of this block depend on a boolean conditiongetIn
(int i) int
getIndex()
int
getInRevIndex
(int i) Get reverse index of the i-th incoming block.int
getOut
(int i) int
getOutRevIndex
(int i) Get reverse index of the i-th outgoing block.int
getStart()
getStop()
Assuming paths out of this block depend on a boolean conditionint
getType()
static int
nameToType
(String name) void
setIndex
(int i) toString()
static String
typeToName
(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
-