Package ghidra.program.model.pcode
Class PcodeBlock
- java.lang.Object
-
- ghidra.program.model.pcode.PcodeBlock
-
- Direct Known Subclasses:
BlockCopy
,BlockGraph
,PcodeBlockBasic
public class PcodeBlock extends java.lang.Object
Blocks of PcodeOps
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PcodeBlock.BlockEdge
-
Field Summary
Fields Modifier and Type Field Description static int
BASIC
static int
CONDITION
static int
COPY
static int
DOWHILE
static int
GOTO
static int
GRAPH
static int
IFELSE
static int
IFGOTO
static int
INFLOOP
static int
LIST
static int
MULTIGOTO
static int
PLAIN
static int
PROPERIF
static int
SWITCH
static int
WHILEDO
-
Constructor Summary
Constructors Constructor Description PcodeBlock()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addInEdge(PcodeBlock b, int lab)
int
calcDepth(PcodeBlock leaf)
PcodeBlock
getFalseOut()
Assuming paths out of this block depend on a boolean conditionPcodeBlock
getFrontLeaf()
PcodeBlock
getIn(int i)
int
getIndex()
int
getInRevIndex(int i)
Get reverse index of the i-th incoming block.int
getInSize()
PcodeBlock
getOut(int i)
int
getOutRevIndex(int i)
Get reverse index of the i-th outgoing block.int
getOutSize()
PcodeBlock
getParent()
Address
getStart()
Address
getStop()
PcodeBlock
getTrueOut()
Assuming paths out of this block depend on a boolean conditionint
getType()
static int
nameToType(java.lang.String name)
protected void
restoreNextInEdge(XmlPullParser parser, BlockMap resolver)
Restore the next input edge via XMLprotected void
restoreNextInEdge(XmlPullParser parser, java.util.ArrayList<? extends PcodeBlock> blockList)
Restore the next input edge via XML.void
restoreXml(XmlPullParser parser, BlockMap resolver)
void
restoreXmlBody(XmlPullParser parser, BlockMap resolver)
Restore the any additional information beyond header and edges from XMLvoid
restoreXmlEdges(XmlPullParser parser, BlockMap resolver)
void
restoreXmlHeader(XmlElement el)
void
saveXml(java.io.Writer writer)
void
saveXmlBody(java.io.Writer writer)
Serialize information about the block to XML, other than header and edge infovoid
saveXmlEdges(java.io.Writer writer)
void
saveXmlHeader(java.lang.StringBuilder buffer)
void
setIndex(int i)
java.lang.String
toString()
static java.lang.String
typeToName(int type)
-
-
-
Field Detail
-
PLAIN
public static final int PLAIN
- See Also:
- Constant Field Values
-
BASIC
public static final int BASIC
- See Also:
- Constant Field Values
-
GRAPH
public static final int GRAPH
- See Also:
- Constant Field Values
-
COPY
public static final int COPY
- See Also:
- Constant Field Values
-
GOTO
public static final int GOTO
- See Also:
- Constant Field Values
-
MULTIGOTO
public static final int MULTIGOTO
- See Also:
- Constant Field Values
-
LIST
public static final int LIST
- See Also:
- Constant Field Values
-
CONDITION
public static final int CONDITION
- See Also:
- Constant Field Values
-
PROPERIF
public static final int PROPERIF
- See Also:
- Constant Field Values
-
IFELSE
public static final int IFELSE
- See Also:
- Constant Field Values
-
IFGOTO
public static final int IFGOTO
- See Also:
- Constant Field Values
-
WHILEDO
public static final int WHILEDO
- See Also:
- Constant Field Values
-
DOWHILE
public static final int DOWHILE
- See Also:
- Constant Field Values
-
SWITCH
public static final int SWITCH
- See Also:
- Constant Field Values
-
INFLOOP
public static final int INFLOOP
- See Also:
- Constant Field Values
-
-
Method Detail
-
typeToName
public static java.lang.String typeToName(int type)
-
nameToType
public static int nameToType(java.lang.String name)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getType
public int getType()
-
getStart
public Address getStart()
- Returns:
- the first Address covered by this block
-
getStop
public Address getStop()
- Returns:
- the last Address covered by this block
-
setIndex
public void setIndex(int i)
-
getIndex
public int getIndex()
-
getParent
public PcodeBlock getParent()
-
addInEdge
protected void addInEdge(PcodeBlock b, int lab)
-
restoreNextInEdge
protected void restoreNextInEdge(XmlPullParser parser, BlockMap resolver) throws PcodeXMLException
Restore the next input edge via XML- Parameters:
parser
-resolver
-- Throws:
PcodeXMLException
-
restoreNextInEdge
protected void restoreNextInEdge(XmlPullParser parser, java.util.ArrayList<? extends PcodeBlock> blockList) throws PcodeXMLException
Restore the next input edge via XML. Resolve block indices via a blockList- Parameters:
parser
-blockList
- allows lookup of PcodeBlock via index- Throws:
PcodeXMLException
-
getIn
public PcodeBlock getIn(int i)
-
getOut
public PcodeBlock getOut(int i)
-
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
public PcodeBlock 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
public PcodeBlock 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
public int calcDepth(PcodeBlock leaf)
-
getFrontLeaf
public PcodeBlock getFrontLeaf()
-
saveXmlHeader
public void saveXmlHeader(java.lang.StringBuilder buffer)
-
restoreXmlHeader
public void restoreXmlHeader(XmlElement el) throws PcodeXMLException
- Throws:
PcodeXMLException
-
saveXmlBody
public void saveXmlBody(java.io.Writer writer) throws java.io.IOException
Serialize information about the block to XML, other than header and edge info- Parameters:
writer
- is where to serialize to- Throws:
java.io.IOException
- if there is a problem with the stream
-
saveXmlEdges
public void saveXmlEdges(java.io.Writer writer) throws java.io.IOException
- Throws:
java.io.IOException
-
restoreXmlBody
public void restoreXmlBody(XmlPullParser parser, BlockMap resolver) throws PcodeXMLException
Restore the any additional information beyond header and edges from XML- Parameters:
parser
- is the XML parserresolver
- is for looking up edge references- Throws:
PcodeXMLException
- for invalid XML descriptions
-
restoreXmlEdges
public void restoreXmlEdges(XmlPullParser parser, BlockMap resolver) throws PcodeXMLException
- Throws:
PcodeXMLException
-
saveXml
public void saveXml(java.io.Writer writer) throws java.io.IOException
- Throws:
java.io.IOException
-
restoreXml
public void restoreXml(XmlPullParser parser, BlockMap resolver) throws PcodeXMLException
- Throws:
PcodeXMLException
-
-