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
public class BlockGraph extends PcodeBlock
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
-
-
Constructor Summary
Constructors Constructor Description BlockGraph()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddBlock(PcodeBlock bl)Add a block to this container.voidaddEdge(PcodeBlock begin, PcodeBlock end)Add a directed edge between two blocks in this containerPcodeBlockgetBlock(int i)Retrieve the i-th block from this containerintgetSize()voidrestoreXml(XmlPullParser parser, AddressFactory factory)Restore all blocks and edges in this container from an XML stream.voidrestoreXmlBody(XmlPullParser parser, BlockMap resolver)Restore the any additional information beyond header and edges from XMLvoidsaveXmlBody(java.io.Writer writer)Serialize information about the block to XML, other than header and edge infovoidsetIndices()Assign a unique index to all blocks in this container.voidtransferObjectRef(BlockGraph ingraph)Recursively run through this structured BlockGraph finding the BlockCopy leaves.-
Methods inherited from class ghidra.program.model.pcode.PcodeBlock
addInEdge, calcDepth, getFalseOut, getFrontLeaf, getIn, getIndex, getInRevIndex, getInSize, getOut, getOutRevIndex, getOutSize, getParent, getStart, getStop, getTrueOut, getType, nameToType, restoreNextInEdge, restoreNextInEdge, restoreXml, restoreXmlEdges, restoreXmlHeader, saveXml, saveXmlEdges, saveXmlHeader, setIndex, toString, typeToName
-
-
-
-
Method Detail
-
addBlock
public void addBlock(PcodeBlock bl)
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
public PcodeBlock getBlock(int i)
Retrieve the i-th block from this container- Parameters:
i- is the index of the block to fetch- Returns:
-
addEdge
public void addEdge(PcodeBlock begin, PcodeBlock end)
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
public void transferObjectRef(BlockGraph ingraph)
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
-
saveXmlBody
public void saveXmlBody(java.io.Writer writer) throws java.io.IOExceptionDescription copied from class:PcodeBlockSerialize information about the block to XML, other than header and edge info- Overrides:
saveXmlBodyin classPcodeBlock- Parameters:
writer- is where to serialize to- Throws:
java.io.IOException- if there is a problem with the stream
-
restoreXmlBody
public void restoreXmlBody(XmlPullParser parser, BlockMap resolver) throws PcodeXMLException
Description copied from class:PcodeBlockRestore the any additional information beyond header and edges from XML- Overrides:
restoreXmlBodyin classPcodeBlock- Parameters:
parser- is the XML parserresolver- is for looking up edge references- Throws:
PcodeXMLException- for invalid XML descriptions
-
restoreXml
public void restoreXml(XmlPullParser parser, AddressFactory factory) throws PcodeXMLException
Restore all blocks and edges in this container from an XML stream.- Parameters:
parser- is the XML stream parserfactory- is the AddressFactory used to construct any Address- Throws:
PcodeXMLException- if part of the XML description is invalid
-
-