Package ghidra.program.model.pcode
Class BlockGraph
java.lang.Object
ghidra.program.model.pcode.PcodeBlock
ghidra.program.model.pcode.BlockGraph
- Direct Known Subclasses:
BlockCondition
,BlockDoWhile
,BlockGoto
,BlockIfElse
,BlockIfGoto
,BlockInfLoop
,BlockList
,BlockMultiGoto
,BlockProperIf
,BlockSwitch
,BlockWhileDo
A block (with in edges and out edges) that contains other blocks
-
Nested Class Summary
Nested classes/interfaces inherited from class ghidra.program.model.pcode.PcodeBlock
PcodeBlock.BlockEdge
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addBlock
(PcodeBlock bl) Add a block to this container.void
addEdge
(PcodeBlock begin, PcodeBlock end) Add a directed edge between two blocks in this containervoid
Decode all blocks and edges in this container from a stream.protected void
decodeBody
(Decoder decoder, BlockMap resolver) Restore the any additional information beyond header and edges from streamprotected void
encodeBody
(Encoder encoder) Encode information about the block to stream, other than header and edge infogetBlock
(int i) Retrieve the i-th block from this containerint
getSize()
void
Assign a unique index to all blocks in this container.void
transferObjectRef
(BlockGraph ingraph) Recursively run through this structured BlockGraph finding the BlockCopy leaves.Methods inherited from class ghidra.program.model.pcode.PcodeBlock
addInEdge, calcDepth, decode, decodeEdges, decodeHeader, decodeNextInEdge, decodeNextInEdge, encode, encodeEdges, encodeHeader, getFalseOut, getFrontLeaf, getIn, getIndex, getInRevIndex, getInSize, getOut, getOutRevIndex, getOutSize, getParent, getStart, getStop, getTrueOut, getType, nameToType, setIndex, toString, typeToName
-
Constructor Details
-
BlockGraph
public BlockGraph()
-
-
Method Details
-
addBlock
Add a block to this container. There are (initially) no edges between it and any other block in the container.- Parameters:
bl
- is the new block to add
-
setIndices
public void setIndices()Assign a unique index to all blocks in this container. After this call, getBlock(i) will return the block that satisfies block.getIndex() == i -
getSize
public int getSize()- Returns:
- the number of blocks in this container
-
getBlock
Retrieve the i-th block from this container- Parameters:
i
- is the index of the block to fetch- Returns:
- the block
-
addEdge
Add a directed edge between two blocks in this container- Parameters:
begin
- is the "from" block of the edgeend
- is the "to" block of the edge
-
transferObjectRef
Recursively run through this structured BlockGraph finding the BlockCopy leaves. Using the BlockCopy altindex, lookup the original BlockCopy in -ingraph- and transfer the Object ref and Address into the leaf- Parameters:
ingraph
- is the original flow graph
-
encodeBody
Description copied from class:PcodeBlock
Encode information about the block to stream, other than header and edge info- Overrides:
encodeBody
in classPcodeBlock
- Parameters:
encoder
- is the stream encoder- Throws:
IOException
- for errors writing to the underlying stream
-
decodeBody
Description copied from class:PcodeBlock
Restore the any additional information beyond header and edges from stream- Overrides:
decodeBody
in classPcodeBlock
- Parameters:
decoder
- is the stream decoderresolver
- is for looking up edge references- Throws:
DecoderException
- for invalid encoding
-
decode
Decode all blocks and edges in this container from a stream.- Parameters:
decoder
- is the stream decoder- Throws:
DecoderException
- if there are invalid encodings
-