miasm
Reverse engineering framework
depgraph Namespace Reference

Classes

class  Arch
 
class  depGraphSettingsForm
 
class  IRATest
 
class  Regs
 

Functions

def clean_lines ()
 
def treat_element ()
 
def next_element ()
 
def launch_depgraph ()
 
def gen_irblock (label, exprs_list)
 
def bloc2graph (irgraph, label=False, lines=True)
 
def dg2graph (graph, label=False, lines=True)
 
def flatNode (node)
 
def flatGraph (graph)
 
def unflatGraph (flat_graph)
 
def get_node_noidx (node)
 
def test_result (graphA, graphB, leaves)
 
def match_results (resultsA, resultsB, nodes)
 
def get_flat_init_depnodes (depnodes)
 

Variables

 parser = ArgumentParser("Dependency grapher")
 
 help
 
 nargs
 
 action
 
 args = parser.parse_args()
 
 loc_db = LocationDB()
 
 cont = Container.from_stream(fstream, loc_db)
 
 arch = args.architecture if args.architecture else cont.arch
 
 machine = Machine(arch)
 
 elements = set()
 
 regs = machine.mn.regs.all_regs_ids_byname
 
 mdis = machine.dis_engine(cont.bin_stream, dont_dis_nulstart_bloc=True, loc_db=loc_db)
 
 ir_arch = machine.ira(loc_db)
 
dictionary init_ctx = {}
 
 e_mem = ExprMem(ExprId("ESP_init", 32) + ExprInt(4 * (i + 1), 32), 32)
 
 asmcfg = mdis.dis_multiblock(int(args.func_addr, 0))
 
 ircfg = ir_arch.new_ircfg_from_asmcfg(asmcfg)
 
 dg
 
 target_addr = int(args.target_addr, 0)
 
 current_loc_key = next(iter(ircfg.getby_offset(target_addr)))
 
int assignblk_index = 0
 
 current_block = ircfg.get_block(current_loc_key)
 
list json_solutions = []
 
string fname = "sol_%d.dot" % sol_nb
 
 results = sol.emul(ir_arch, ctx=init_ctx)
 
dictionary tokens = {str(k): str(v) for k, v in viewitems(results)}
 
string result = ", ".join("=".join(x) for x in viewitems(tokens))
 
 sat = sol.is_satisfiable
 
dictionary constraints = {}
 
bool EMULATION = True
 
 STEP_COUNTER = count()
 
 A = ExprId("a", 32)
 
 B = ExprId("b", 32)
 
 C = ExprId("c", 32)
 
 D = ExprId("d", 32)
 
 R = ExprId("r", 32)
 
 COND = ExprId("cond", 32)
 
 A_INIT = ExprId("a_init", 32)
 
 B_INIT = ExprId("b_init", 32)
 
 C_INIT = ExprId("c_init", 32)
 
 D_INIT = ExprId("d_init", 32)
 
 PC = ExprId("pc", 32)
 
 SP = ExprId("sp", 32)
 
 CST0 = ExprInt(0x0, 32)
 
 CST1 = ExprInt(0x1, 32)
 
 CST2 = ExprInt(0x2, 32)
 
 CST3 = ExprInt(0x3, 32)
 
 CST22 = ExprInt(0x22, 32)
 
 CST23 = ExprInt(0x23, 32)
 
 CST24 = ExprInt(0x24, 32)
 
 CST33 = ExprInt(0x33, 32)
 
 CST35 = ExprInt(0x35, 32)
 
 CST37 = ExprInt(0x37, 32)
 
 LBL0 = loc_db.add_location("lbl0", 0)
 
 LBL1 = loc_db.add_location("lbl1", 1)
 
 LBL2 = loc_db.add_location("lbl2", 2)
 
 LBL3 = loc_db.add_location("lbl3", 3)
 
 LBL4 = loc_db.add_location("lbl4", 4)
 
 LBL5 = loc_db.add_location("lbl5", 5)
 
 LBL6 = loc_db.add_location("lbl6", 6)
 
 DNA = DependencyNode(LBL2, A, 0)
 
 DNB = DependencyNode(LBL1, B, 1)
 
 DNC = DependencyNode(LBL1, C, 0)
 
 DNB2 = DependencyNode(LBL1, B, 1)
 
 DNC2 = DependencyNode(LBL1, C, 0)
 
 DNB3 = DependencyNode(LBL1, B, 1)
 
 DNC3 = DependencyNode(LBL1, C, 0)
 
 IRA = IRATest(loc_db)
 
 IRDst = IRA.IRDst
 
 END = ExprId("END", IRDst.size)
 
 G1_IRA = IRA.new_ircfg()
 
def G1_IRB0 = gen_irblock(LBL0, [[ExprAssign(C, CST1), ExprAssign(IRDst, ExprLoc(LBL1, 32))]])
 
def G1_IRB1 = gen_irblock(LBL1, [[ExprAssign(B, C), ExprAssign(IRDst, ExprLoc(LBL2, 32))]])
 
def G1_IRB2 = gen_irblock(LBL2, [[ExprAssign(A, B), ExprAssign(IRDst, END)]])
 
 G2_IRA = IRA.new_ircfg()
 
def G2_IRB0 = gen_irblock(LBL0, [[ExprAssign(C, CST1), ExprAssign(IRDst, ExprLoc(LBL1, 32))]])
 
def G2_IRB1 = gen_irblock(LBL1, [[ExprAssign(B, CST2), ExprAssign(IRDst, ExprLoc(LBL2, 32))]])
 
def G2_IRB2 = gen_irblock(LBL2, [[ExprAssign(A, B + C), ExprAssign(IRDst, END)]])
 
 G3_IRA = IRA.new_ircfg()
 
def G3_IRB0
 
def G3_IRB1 = gen_irblock(LBL1, [[ExprAssign(B, CST2), ExprAssign(IRDst, ExprLoc(LBL3, 32))]])
 
def G3_IRB2 = gen_irblock(LBL2, [[ExprAssign(B, CST3), ExprAssign(IRDst, ExprLoc(LBL3, 32))]])
 
def G3_IRB3 = gen_irblock(LBL3, [[ExprAssign(A, B + C), ExprAssign(IRDst, END)]])
 
 G4_IRA = IRA.new_ircfg()
 
def G4_IRB0 = gen_irblock(LBL0, [[ExprAssign(C, CST1), ExprAssign(IRDst, ExprLoc(LBL1, 32))]])
 
def G4_IRB1
 
def G4_IRB2 = gen_irblock(LBL2, [[ExprAssign(A, B), ExprAssign(IRDst, END)]])
 
 G5_IRA = IRA.new_ircfg()
 
def G5_IRB0 = gen_irblock(LBL0, [[ExprAssign(B, CST1), ExprAssign(IRDst, ExprLoc(LBL1, 32))]])
 
def G5_IRB1
 
def G5_IRB2 = gen_irblock(LBL2, [[ExprAssign(A, B), ExprAssign(IRDst, END)]])
 
 G6_IRA = IRA.new_ircfg()
 
def G6_IRB0 = gen_irblock(LBL0, [[ExprAssign(B, CST1), ExprAssign(IRDst, ExprLoc(LBL1, 32))]])
 
def G6_IRB1 = gen_irblock(LBL1, [[ExprAssign(A, B), ExprAssign(IRDst, ExprLoc(LBL1, 32))]])
 
 G7_IRA = IRA.new_ircfg()
 
def G7_IRB0 = gen_irblock(LBL0, [[ExprAssign(C, CST1), ExprAssign(IRDst, ExprLoc(LBL1, 32))]])
 
def G7_IRB1
 
def G7_IRB2 = gen_irblock(LBL2, [[ExprAssign(D, A), ExprAssign(IRDst, END)]])
 
 G8_IRA = IRA.new_ircfg()
 
def G8_IRB0 = gen_irblock(LBL0, [[ExprAssign(C, CST1), ExprAssign(IRDst, ExprLoc(LBL1, 32))]])
 
def G8_IRB1
 
def G8_IRB2 = gen_irblock(LBL2, [[ExprAssign(A, B), ExprAssign(IRDst, END)]])
 
 G10_IRA = IRA.new_ircfg()
 
def G10_IRB1
 
def G10_IRB2 = gen_irblock(LBL2, [[ExprAssign(A, B), ExprAssign(IRDst, END)]])
 
 G11_IRA = IRA.new_ircfg()
 
def G11_IRB0
 
def G11_IRB1
 
def G11_IRB2 = gen_irblock(LBL2, [[ExprAssign(A, A - B), ExprAssign(IRDst, END)]])
 
 G12_IRA = IRA.new_ircfg()
 
def G12_IRB0 = gen_irblock(LBL0, [[ExprAssign(B, CST1), ExprAssign(IRDst, ExprLoc(LBL1, 32))]])
 
def G12_IRB1
 
def G12_IRB2 = gen_irblock(LBL2, [[ExprAssign(B, A), ExprAssign(IRDst, END)]])
 
 G13_IRA = IRA.new_ircfg()
 
def G13_IRB0
 
def G13_IRB1
 
def G13_IRB2
 
def G13_IRB3 = gen_irblock(LBL3, [[ExprAssign(R, C), ExprAssign(IRDst, END)]])
 
 G14_IRA = IRA.new_ircfg()
 
def G14_IRB0
 
def G14_IRB1
 
def G14_IRB2
 
def G14_IRB3 = gen_irblock(LBL3, [[ExprAssign(R, D + B), ExprAssign(IRDst, END)]])
 
 G15_IRA = IRA.new_ircfg()
 
def G15_IRB0 = gen_irblock(LBL0, [[ExprAssign(A, CST1), ExprAssign(IRDst, ExprLoc(LBL1, 32))]])
 
def G15_IRB1
 
def G15_IRB2 = gen_irblock(LBL2, [[ExprAssign(R, B), ExprAssign(IRDst, END)]])
 
 G16_IRA = IRA.new_ircfg()
 
def G16_IRB0
 
def G16_IRB1
 
def G16_IRB2 = gen_irblock(LBL2, [[ExprAssign(D, A), ExprAssign(IRDst, ExprLoc(LBL1, 32))]])
 
def G16_IRB3 = gen_irblock(LBL3, [[ExprAssign(R, D), ExprAssign(IRDst, ExprLoc(LBL1, 32))]])
 
def G16_IRB4 = gen_irblock(LBL4, [[ExprAssign(R, A), ExprAssign(IRDst, ExprLoc(LBL1, 32))]])
 
def G16_IRB5 = gen_irblock(LBL5, [[ExprAssign(R, A), ExprAssign(IRDst, ExprLoc(LBL1, 32))]])
 
 G17_IRA = IRA.new_ircfg()
 
def G17_IRB0
 
def G17_IRB1
 
def G17_IRB2
 
 G1_TEST1_DN1
 
tuple G1_INPUT = (set([G1_TEST1_DN1]), set([G1_IRB0.loc_key]))
 
 G2_TEST1_DN1
 
tuple G2_INPUT = (set([G2_TEST1_DN1]), set([G2_IRB0.loc_key]))
 
 G3_TEST1_0_DN1
 
tuple G3_INPUT = (set([G3_TEST1_0_DN1]), set([G3_IRB0.loc_key]))
 
 G4_TEST1_DN1
 
tuple G4_INPUT = (set([G4_TEST1_DN1]), set([G4_IRB0.loc_key]))
 
 G5_TEST1_0_DN1
 
tuple G5_INPUT = (set([G5_TEST1_0_DN1]), set([G5_IRB0.loc_key]))
 
 G6_TEST1_0_DN1
 
tuple G6_INPUT = (set([G6_TEST1_0_DN1]), set([G6_IRB0.loc_key]))
 
 G7_TEST1_0_DN1
 
tuple G7_INPUT = (set([G7_TEST1_0_DN1]), set([G7_IRB0.loc_key]))
 
 G8_TEST1_0_DN1
 
tuple G8_INPUT = (set([G8_TEST1_0_DN1]), set([G3_IRB0.loc_key]))
 
 G9_TEST1_0_DN1
 
 G9_TEST1_0_DN5
 
tuple G9_INPUT = (set([G9_TEST1_0_DN1, G9_TEST1_0_DN5]), set([G8_IRB0.loc_key]))
 
 G10_TEST1_0_DN1
 
tuple G10_INPUT = (set([G10_TEST1_0_DN1]), set([G10_IRB1.loc_key]))
 
 G11_TEST1_DN1
 
tuple G11_INPUT = (set([G11_TEST1_DN1]), set([G11_IRB0.loc_key]))
 
 G12_TEST1_0_DN1 = DependencyNode(G12_IRB2.loc_key, B, 1)
 
tuple G12_INPUT = (set([G12_TEST1_0_DN1]), set([]))
 
 G13_TEST1_0_DN4 = DependencyNode(G13_IRB3.loc_key, R, 1)
 
tuple G13_INPUT = (set([G13_TEST1_0_DN4]), set([]))
 
 G14_TEST1_0_DN1 = DependencyNode(G14_IRB3.loc_key, R, 1)
 
tuple G14_INPUT = (set([G14_TEST1_0_DN1]), set([]))
 
 G15_TEST1_0_DN1 = DependencyNode(G15_IRB2.loc_key, R, 1)
 
tuple G15_INPUT = (set([G15_TEST1_0_DN1]), set([]))
 
 G16_TEST1_0_DN1 = DependencyNode(G16_IRB5.loc_key, R, 1)
 
tuple G16_INPUT = (set([G16_TEST1_0_DN1]), set([]))
 
 G17_TEST1_DN1 = DependencyNode(G17_IRB2.loc_key, A, 1)
 
tuple G17_INPUT = (set([G17_TEST1_DN1]), set([]))
 
 FAILED = set()
 
list flat_test_results
 
list test_results
 
list all_flats = []
 
 depnodes
 
 heads
 
list suffix_key_list
 
list mode_suffix = suffix_key_list[g_ind]
 
string graph_test_key = "graph" + mode_suffix
 
 all_results = set()
 
 all_flat = set()
 
def flat_depnodes = get_flat_init_depnodes(depnodes)
 
 test_num
 
 end
 

Detailed Description

Regression test module for DependencyGraph

Function Documentation

◆ bloc2graph()

def depgraph.bloc2graph (   irgraph,
  label = False,
  lines = True 
)
Render dot graph of @blocks

◆ clean_lines()

def depgraph.clean_lines ( )
Here is the caller graph for this function:

◆ dg2graph()

def depgraph.dg2graph (   graph,
  label = False,
  lines = True 
)
Render dot graph of @blocks

◆ flatGraph()

def depgraph.flatGraph (   graph)
Here is the call graph for this function:

◆ flatNode()

def depgraph.flatNode (   node)
Here is the caller graph for this function:

◆ gen_irblock()

def depgraph.gen_irblock (   label,
  exprs_list 
)
 Returns an IRBlock.
Used only for tests purpose

◆ get_flat_init_depnodes()

def depgraph.get_flat_init_depnodes (   depnodes)

◆ get_node_noidx()

def depgraph.get_node_noidx (   node)
Here is the caller graph for this function:

◆ launch_depgraph()

def depgraph.launch_depgraph ( )
Here is the call graph for this function:

◆ match_results()

def depgraph.match_results (   resultsA,
  resultsB,
  nodes 
)
Match computed list of graph against test cases
Here is the call graph for this function:

◆ next_element()

def depgraph.next_element ( )
Here is the call graph for this function:

◆ test_result()

def depgraph.test_result (   graphA,
  graphB,
  leaves 
)
Test graph equality without using node index
Here is the call graph for this function:
Here is the caller graph for this function:

◆ treat_element()

def depgraph.treat_element ( )
Here is the caller graph for this function:

◆ unflatGraph()

def depgraph.unflatGraph (   flat_graph)
Here is the caller graph for this function:

Variable Documentation

◆ A

depgraph.A = ExprId("a", 32)

◆ A_INIT

depgraph.A_INIT = ExprId("a_init", 32)

◆ action

depgraph.action

◆ all_flat

depgraph.all_flat = set()

◆ all_flats

list depgraph.all_flats = []

◆ all_results

depgraph.all_results = set()

◆ arch

depgraph.arch = args.architecture if args.architecture else cont.arch

◆ args

depgraph.args = parser.parse_args()

◆ asmcfg

depgraph.asmcfg = mdis.dis_multiblock(int(args.func_addr, 0))

◆ assignblk_index

int depgraph.assignblk_index = 0

◆ B

depgraph.B = ExprId("b", 32)

◆ B_INIT

depgraph.B_INIT = ExprId("b_init", 32)

◆ C

depgraph.C = ExprId("c", 32)

◆ C_INIT

depgraph.C_INIT = ExprId("c_init", 32)

◆ COND

depgraph.COND = ExprId("cond", 32)

◆ constraints

dictionary depgraph.constraints = {}

◆ cont

depgraph.cont = Container.from_stream(fstream, loc_db)

◆ CST0

depgraph.CST0 = ExprInt(0x0, 32)

◆ CST1

depgraph.CST1 = ExprInt(0x1, 32)

◆ CST2

depgraph.CST2 = ExprInt(0x2, 32)

◆ CST22

depgraph.CST22 = ExprInt(0x22, 32)

◆ CST23

depgraph.CST23 = ExprInt(0x23, 32)

◆ CST24

depgraph.CST24 = ExprInt(0x24, 32)

◆ CST3

depgraph.CST3 = ExprInt(0x3, 32)

◆ CST33

depgraph.CST33 = ExprInt(0x33, 32)

◆ CST35

depgraph.CST35 = ExprInt(0x35, 32)

◆ CST37

depgraph.CST37 = ExprInt(0x37, 32)

◆ current_block

depgraph.current_block = ircfg.get_block(current_loc_key)

◆ current_loc_key

depgraph.current_loc_key = next(iter(ircfg.getby_offset(target_addr)))

◆ D

depgraph.D = ExprId("d", 32)

◆ D_INIT

depgraph.D_INIT = ExprId("d_init", 32)

◆ depnodes

depgraph.depnodes

◆ dg

depgraph.dg
Initial value:
1 = DependencyGraph(
2  ircfg, implicit=args.implicit,
3  apply_simp=not args.do_not_simplify,
4  follow_mem=not args.unfollow_mem,
5  follow_call=not args.unfollow_call
6 )

◆ DNA

depgraph.DNA = DependencyNode(LBL2, A, 0)

◆ DNB

depgraph.DNB = DependencyNode(LBL1, B, 1)

◆ DNB2

depgraph.DNB2 = DependencyNode(LBL1, B, 1)

◆ DNB3

depgraph.DNB3 = DependencyNode(LBL1, B, 1)

◆ DNC

depgraph.DNC = DependencyNode(LBL1, C, 0)

◆ DNC2

depgraph.DNC2 = DependencyNode(LBL1, C, 0)

◆ DNC3

depgraph.DNC3 = DependencyNode(LBL1, C, 0)

◆ e_mem

depgraph.e_mem = ExprMem(ExprId("ESP_init", 32) + ExprInt(4 * (i + 1), 32), 32)

◆ elements

depgraph.elements = set()

◆ EMULATION

bool depgraph.EMULATION = True

◆ END

depgraph.END = ExprId("END", IRDst.size)

◆ end

depgraph.end

◆ FAILED

depgraph.FAILED = set()

◆ flat_depnodes

def depgraph.flat_depnodes = get_flat_init_depnodes(depnodes)

◆ flat_test_results

list depgraph.flat_test_results

◆ fname

string depgraph.fname = "sol_%d.dot" % sol_nb

◆ G10_INPUT

tuple depgraph.G10_INPUT = (set([G10_TEST1_0_DN1]), set([G10_IRB1.loc_key]))

◆ G10_IRA

depgraph.G10_IRA = IRA.new_ircfg()

◆ G10_IRB1

def depgraph.G10_IRB1
Initial value:
2  LBL1,
3  [
4  [ExprAssign(B, B + CST2),
5  ExprAssign(
6  IRDst,
7  ExprCond(
8  COND,
9  ExprLoc(LBL1, 32),
10  ExprLoc(LBL2, 32)
11  )
12  )
13  ]
14  ]
15 )

◆ G10_IRB2

def depgraph.G10_IRB2 = gen_irblock(LBL2, [[ExprAssign(A, B), ExprAssign(IRDst, END)]])

◆ G10_TEST1_0_DN1

depgraph.G10_TEST1_0_DN1
Initial value:
1 = DependencyNode(
2  G10_IRB2.loc_key, A, len(G10_IRB2))

◆ G11_INPUT

tuple depgraph.G11_INPUT = (set([G11_TEST1_DN1]), set([G11_IRB0.loc_key]))

◆ G11_IRA

depgraph.G11_IRA = IRA.new_ircfg()

◆ G11_IRB0

def depgraph.G11_IRB0
Initial value:
2  LBL0,
3  [
4  [ExprAssign(A, CST1),
5  ExprAssign(B, CST2),
6  ExprAssign(IRDst, ExprLoc(LBL1, 32))
7  ]
8  ]
9 )

◆ G11_IRB1

def depgraph.G11_IRB1
Initial value:
2  LBL1,
3  [
4  [ExprAssign(A, B),
5  ExprAssign(B, A),
6  ExprAssign(IRDst, ExprLoc(LBL2, 32))
7  ]
8  ]
9 )

◆ G11_IRB2

def depgraph.G11_IRB2 = gen_irblock(LBL2, [[ExprAssign(A, A - B), ExprAssign(IRDst, END)]])

◆ G11_TEST1_DN1

depgraph.G11_TEST1_DN1
Initial value:
1 = DependencyNode(
2  G11_IRB2.loc_key, A, len(G11_IRB2))

◆ G12_INPUT

tuple depgraph.G12_INPUT = (set([G12_TEST1_0_DN1]), set([]))

◆ G12_IRA

depgraph.G12_IRA = IRA.new_ircfg()

◆ G12_IRB0

def depgraph.G12_IRB0 = gen_irblock(LBL0, [[ExprAssign(B, CST1), ExprAssign(IRDst, ExprLoc(LBL1, 32))]])

◆ G12_IRB1

def depgraph.G12_IRB1
Initial value:
2  LBL1,
3  [
4  [ExprAssign(A, B)],
5  [ExprAssign(B, B + CST2),
6  ExprAssign(
7  IRDst,
8  ExprCond(
9  COND,
10  ExprLoc(LBL1, 32),
11  ExprLoc(LBL2, 32)
12  )
13  )
14  ]
15  ]
16 )

◆ G12_IRB2

def depgraph.G12_IRB2 = gen_irblock(LBL2, [[ExprAssign(B, A), ExprAssign(IRDst, END)]])

◆ G12_TEST1_0_DN1

depgraph.G12_TEST1_0_DN1 = DependencyNode(G12_IRB2.loc_key, B, 1)

◆ G13_INPUT

tuple depgraph.G13_INPUT = (set([G13_TEST1_0_DN4]), set([]))

◆ G13_IRA

depgraph.G13_IRA = IRA.new_ircfg()

◆ G13_IRB0

def depgraph.G13_IRB0
Initial value:
1 = gen_irblock(LBL0, [[ExprAssign(A, CST1)],
2  #[ExprAssign(B, A)],
3  [ExprAssign(IRDst,
4  ExprLoc(LBL1, 32))]])

◆ G13_IRB1

def depgraph.G13_IRB1
Initial value:
1 = gen_irblock(LBL1, [[ExprAssign(C, A)],
2  #[ExprAssign(A, A + CST1)],
3  [ExprAssign(IRDst,
4  ExprCond(
5  R,
6  ExprLoc(LBL2, 32),
7  ExprLoc(LBL3, 32)
8  )
9  )]])

◆ G13_IRB2

def depgraph.G13_IRB2
Initial value:
1 = gen_irblock(LBL2, [[ExprAssign(B, A + CST3)], [ExprAssign(A, B + CST3)],
2  [ExprAssign(IRDst,
3  ExprLoc(LBL1, 32))]])

◆ G13_IRB3

def depgraph.G13_IRB3 = gen_irblock(LBL3, [[ExprAssign(R, C), ExprAssign(IRDst, END)]])

◆ G13_TEST1_0_DN4

depgraph.G13_TEST1_0_DN4 = DependencyNode(G13_IRB3.loc_key, R, 1)

◆ G14_INPUT

tuple depgraph.G14_INPUT = (set([G14_TEST1_0_DN1]), set([]))

◆ G14_IRA

depgraph.G14_IRA = IRA.new_ircfg()

◆ G14_IRB0

def depgraph.G14_IRB0
Initial value:
1 = gen_irblock(LBL0, [[ExprAssign(A, CST1)],
2  [ExprAssign(IRDst,
3  ExprLoc(LBL1, 32))]
4  ])

◆ G14_IRB1

def depgraph.G14_IRB1
Initial value:
1 = gen_irblock(LBL1, [[ExprAssign(B, A)],
2  [ExprAssign(IRDst,
3  ExprCond(
4  C,
5  ExprLoc(LBL2, 32),
6  ExprLoc(LBL3, 32)
7  )
8  )
9  ]
10  ])

◆ G14_IRB2

def depgraph.G14_IRB2
Initial value:
1 = gen_irblock(LBL2, [[ExprAssign(D, A)],
2  [ExprAssign(A, D + CST1)],
3  [ExprAssign(IRDst,
4  ExprLoc(LBL1, 32))]
5  ])

◆ G14_IRB3

def depgraph.G14_IRB3 = gen_irblock(LBL3, [[ExprAssign(R, D + B), ExprAssign(IRDst, END)]])

◆ G14_TEST1_0_DN1

depgraph.G14_TEST1_0_DN1 = DependencyNode(G14_IRB3.loc_key, R, 1)

◆ G15_INPUT

tuple depgraph.G15_INPUT = (set([G15_TEST1_0_DN1]), set([]))

◆ G15_IRA

depgraph.G15_IRA = IRA.new_ircfg()

◆ G15_IRB0

def depgraph.G15_IRB0 = gen_irblock(LBL0, [[ExprAssign(A, CST1), ExprAssign(IRDst, ExprLoc(LBL1, 32))]])

◆ G15_IRB1

def depgraph.G15_IRB1
Initial value:
1 = gen_irblock(LBL1, [[ExprAssign(D, A + B)],
2  [ExprAssign(C, D)],
3  [ExprAssign(B, C),
4  ExprAssign(IRDst,
5  ExprCond(
6  C,
7  ExprLoc(LBL1, 32),
8  ExprLoc(LBL2, 32)
9  )
10  )]])

◆ G15_IRB2

def depgraph.G15_IRB2 = gen_irblock(LBL2, [[ExprAssign(R, B), ExprAssign(IRDst, END)]])

◆ G15_TEST1_0_DN1

depgraph.G15_TEST1_0_DN1 = DependencyNode(G15_IRB2.loc_key, R, 1)

◆ G16_INPUT

tuple depgraph.G16_INPUT = (set([G16_TEST1_0_DN1]), set([]))

◆ G16_IRA

depgraph.G16_IRA = IRA.new_ircfg()

◆ G16_IRB0

def depgraph.G16_IRB0
Initial value:
2  LBL0, [
3  [ExprAssign(A, CST1), ExprAssign(IRDst, ExprLoc(LBL1, 32))]
4  ]
5 )

◆ G16_IRB1

def depgraph.G16_IRB1
Initial value:
2  LBL1,
3  [
4  [ExprAssign(R, D),
5  ExprAssign(
6  IRDst,
7  ExprCond(
8  C,
9  ExprCond(
10  C,
11  ExprCond(
12  C,
13  ExprLoc(LBL2, 32),
14  ExprLoc(LBL3, 32)
15  ),
16  ExprLoc(LBL4, 32)
17  ),
18  ExprLoc(LBL5, 32)
19  )
20  )
21  ]
22  ]
23 )

◆ G16_IRB2

def depgraph.G16_IRB2 = gen_irblock(LBL2, [[ExprAssign(D, A), ExprAssign(IRDst, ExprLoc(LBL1, 32))]])

◆ G16_IRB3

def depgraph.G16_IRB3 = gen_irblock(LBL3, [[ExprAssign(R, D), ExprAssign(IRDst, ExprLoc(LBL1, 32))]])

◆ G16_IRB4

def depgraph.G16_IRB4 = gen_irblock(LBL4, [[ExprAssign(R, A), ExprAssign(IRDst, ExprLoc(LBL1, 32))]])

◆ G16_IRB5

def depgraph.G16_IRB5 = gen_irblock(LBL5, [[ExprAssign(R, A), ExprAssign(IRDst, ExprLoc(LBL1, 32))]])

◆ G16_TEST1_0_DN1

depgraph.G16_TEST1_0_DN1 = DependencyNode(G16_IRB5.loc_key, R, 1)

◆ G17_INPUT

tuple depgraph.G17_INPUT = (set([G17_TEST1_DN1]), set([]))

◆ G17_IRA

depgraph.G17_IRA = IRA.new_ircfg()

◆ G17_IRB0

def depgraph.G17_IRB0
Initial value:
1 = gen_irblock(LBL0, [[ExprAssign(A, CST1),
2  ExprAssign(D, CST2),
3  ExprAssign(IRDst, ExprLoc(LBL1, 32))]])

◆ G17_IRB1

def depgraph.G17_IRB1
Initial value:
1 = gen_irblock(LBL1, [[ExprAssign(A, D),
2  ExprAssign(B, D),
3  ExprAssign(IRDst, ExprLoc(LBL2, 32))]])

◆ G17_IRB2

def depgraph.G17_IRB2
Initial value:
1 = gen_irblock(LBL2, [[ExprAssign(A, A - B),
2  ExprAssign(IRDst, END)]])

◆ G17_TEST1_DN1

depgraph.G17_TEST1_DN1 = DependencyNode(G17_IRB2.loc_key, A, 1)

◆ G1_INPUT

tuple depgraph.G1_INPUT = (set([G1_TEST1_DN1]), set([G1_IRB0.loc_key]))

◆ G1_IRA

depgraph.G1_IRA = IRA.new_ircfg()

◆ G1_IRB0

def depgraph.G1_IRB0 = gen_irblock(LBL0, [[ExprAssign(C, CST1), ExprAssign(IRDst, ExprLoc(LBL1, 32))]])

◆ G1_IRB1

def depgraph.G1_IRB1 = gen_irblock(LBL1, [[ExprAssign(B, C), ExprAssign(IRDst, ExprLoc(LBL2, 32))]])

◆ G1_IRB2

def depgraph.G1_IRB2 = gen_irblock(LBL2, [[ExprAssign(A, B), ExprAssign(IRDst, END)]])

◆ G1_TEST1_DN1

depgraph.G1_TEST1_DN1
Initial value:
1 = DependencyNode(
2  G1_IRB2.loc_key, A, len(G1_IRB2))

◆ G2_INPUT

tuple depgraph.G2_INPUT = (set([G2_TEST1_DN1]), set([G2_IRB0.loc_key]))

◆ G2_IRA

depgraph.G2_IRA = IRA.new_ircfg()

◆ G2_IRB0

def depgraph.G2_IRB0 = gen_irblock(LBL0, [[ExprAssign(C, CST1), ExprAssign(IRDst, ExprLoc(LBL1, 32))]])

◆ G2_IRB1

def depgraph.G2_IRB1 = gen_irblock(LBL1, [[ExprAssign(B, CST2), ExprAssign(IRDst, ExprLoc(LBL2, 32))]])

◆ G2_IRB2

def depgraph.G2_IRB2 = gen_irblock(LBL2, [[ExprAssign(A, B + C), ExprAssign(IRDst, END)]])

◆ G2_TEST1_DN1

depgraph.G2_TEST1_DN1
Initial value:
1 = DependencyNode(
2  G2_IRB2.loc_key, A, len(G2_IRB2))

◆ G3_INPUT

tuple depgraph.G3_INPUT = (set([G3_TEST1_0_DN1]), set([G3_IRB0.loc_key]))

◆ G3_IRA

depgraph.G3_IRA = IRA.new_ircfg()

◆ G3_IRB0

def depgraph.G3_IRB0
Initial value:
2  LBL0,
3  [
4  [ExprAssign(C, CST1), ExprAssign(
5  IRDst, ExprCond(
6  COND,
7  ExprLoc(LBL1, 32),
8  ExprLoc(LBL2, 32)
9  )
10  )
11  ]
12  ]
13 )

◆ G3_IRB1

def depgraph.G3_IRB1 = gen_irblock(LBL1, [[ExprAssign(B, CST2), ExprAssign(IRDst, ExprLoc(LBL3, 32))]])

◆ G3_IRB2

def depgraph.G3_IRB2 = gen_irblock(LBL2, [[ExprAssign(B, CST3), ExprAssign(IRDst, ExprLoc(LBL3, 32))]])

◆ G3_IRB3

def depgraph.G3_IRB3 = gen_irblock(LBL3, [[ExprAssign(A, B + C), ExprAssign(IRDst, END)]])

◆ G3_TEST1_0_DN1

depgraph.G3_TEST1_0_DN1
Initial value:
1 = DependencyNode(
2  G3_IRB3.loc_key, A, len(G3_IRB3))

◆ G4_INPUT

tuple depgraph.G4_INPUT = (set([G4_TEST1_DN1]), set([G4_IRB0.loc_key]))

◆ G4_IRA

depgraph.G4_IRA = IRA.new_ircfg()

◆ G4_IRB0

def depgraph.G4_IRB0 = gen_irblock(LBL0, [[ExprAssign(C, CST1), ExprAssign(IRDst, ExprLoc(LBL1, 32))]])

◆ G4_IRB1

def depgraph.G4_IRB1
Initial value:
2  LBL1,
3  [
4  [ExprAssign(C, C + CST2)],
5  [ExprAssign(IRDst,
6  ExprCond(
7  C,
8  ExprLoc(LBL2, 32),
9  ExprLoc(LBL1, 32))
10  )
11  ]]
12 )

◆ G4_IRB2

def depgraph.G4_IRB2 = gen_irblock(LBL2, [[ExprAssign(A, B), ExprAssign(IRDst, END)]])

◆ G4_TEST1_DN1

depgraph.G4_TEST1_DN1
Initial value:
1 = DependencyNode(
2  G4_IRB2.loc_key, A, len(G2_IRB0))

◆ G5_INPUT

tuple depgraph.G5_INPUT = (set([G5_TEST1_0_DN1]), set([G5_IRB0.loc_key]))

◆ G5_IRA

depgraph.G5_IRA = IRA.new_ircfg()

◆ G5_IRB0

def depgraph.G5_IRB0 = gen_irblock(LBL0, [[ExprAssign(B, CST1), ExprAssign(IRDst, ExprLoc(LBL1, 32))]])

◆ G5_IRB1

def depgraph.G5_IRB1
Initial value:
2  LBL1,
3  [
4  [ExprAssign(B, B + CST2)],
5  [ExprAssign(
6  IRDst,
7  ExprCond(
8  B,
9  ExprLoc(LBL2, 32),
10  ExprLoc(LBL1, 32)
11  )
12  )
13  ]
14  ]
15 )

◆ G5_IRB2

def depgraph.G5_IRB2 = gen_irblock(LBL2, [[ExprAssign(A, B), ExprAssign(IRDst, END)]])

◆ G5_TEST1_0_DN1

depgraph.G5_TEST1_0_DN1
Initial value:
1 = DependencyNode(
2  G5_IRB2.loc_key, A, len(G5_IRB2))

◆ G6_INPUT

tuple depgraph.G6_INPUT = (set([G6_TEST1_0_DN1]), set([G6_IRB0.loc_key]))

◆ G6_IRA

depgraph.G6_IRA = IRA.new_ircfg()

◆ G6_IRB0

def depgraph.G6_IRB0 = gen_irblock(LBL0, [[ExprAssign(B, CST1), ExprAssign(IRDst, ExprLoc(LBL1, 32))]])

◆ G6_IRB1

def depgraph.G6_IRB1 = gen_irblock(LBL1, [[ExprAssign(A, B), ExprAssign(IRDst, ExprLoc(LBL1, 32))]])

◆ G6_TEST1_0_DN1

depgraph.G6_TEST1_0_DN1
Initial value:
1 = DependencyNode(
2  G6_IRB1.loc_key, A, len(G6_IRB1))

◆ G7_INPUT

tuple depgraph.G7_INPUT = (set([G7_TEST1_0_DN1]), set([G7_IRB0.loc_key]))

◆ G7_IRA

depgraph.G7_IRA = IRA.new_ircfg()

◆ G7_IRB0

def depgraph.G7_IRB0 = gen_irblock(LBL0, [[ExprAssign(C, CST1), ExprAssign(IRDst, ExprLoc(LBL1, 32))]])

◆ G7_IRB1

def depgraph.G7_IRB1
Initial value:
2  LBL1,
3  [
4  [ExprAssign(B, C)],
5  [ExprAssign(A, B)],
6  [ExprAssign(
7  IRDst,
8  ExprCond(
9  COND,
10  ExprLoc(LBL1, 32),
11  ExprLoc(LBL2, 32)
12  )
13  )
14  ]
15  ]
16 )

◆ G7_IRB2

def depgraph.G7_IRB2 = gen_irblock(LBL2, [[ExprAssign(D, A), ExprAssign(IRDst, END)]])

◆ G7_TEST1_0_DN1

depgraph.G7_TEST1_0_DN1
Initial value:
1 = DependencyNode(
2  G7_IRB2.loc_key, D, len(G7_IRB2))

◆ G8_INPUT

tuple depgraph.G8_INPUT = (set([G8_TEST1_0_DN1]), set([G3_IRB0.loc_key]))

◆ G8_IRA

depgraph.G8_IRA = IRA.new_ircfg()

◆ G8_IRB0

def depgraph.G8_IRB0 = gen_irblock(LBL0, [[ExprAssign(C, CST1), ExprAssign(IRDst, ExprLoc(LBL1, 32))]])

◆ G8_IRB1

def depgraph.G8_IRB1
Initial value:
2  LBL1,
3  [
4  [ExprAssign(B, C)],
5  [ExprAssign(C, D),
6  ExprAssign(
7  IRDst,
8  ExprCond(
9  COND,
10  ExprLoc(LBL1, 32),
11  ExprLoc(LBL2, 32)
12  )
13  )
14  ]
15  ]
16 )

◆ G8_IRB2

def depgraph.G8_IRB2 = gen_irblock(LBL2, [[ExprAssign(A, B), ExprAssign(IRDst, END)]])

◆ G8_TEST1_0_DN1

depgraph.G8_TEST1_0_DN1
Initial value:
1 = DependencyNode(
2  G8_IRB2.loc_key, A, len(G8_IRB2))

◆ G9_INPUT

tuple depgraph.G9_INPUT = (set([G9_TEST1_0_DN1, G9_TEST1_0_DN5]), set([G8_IRB0.loc_key]))

◆ G9_TEST1_0_DN1

depgraph.G9_TEST1_0_DN1
Initial value:
1 = DependencyNode(
2  G8_IRB2.loc_key, A, len(G8_IRB2))

◆ G9_TEST1_0_DN5

depgraph.G9_TEST1_0_DN5
Initial value:
1 = DependencyNode(
2  G8_IRB2.loc_key, C, len(G8_IRB2))

◆ graph_test_key

string depgraph.graph_test_key = "graph" + mode_suffix

◆ heads

depgraph.heads

◆ help

depgraph.help

◆ init_ctx

dictionary depgraph.init_ctx = {}

◆ ir_arch

depgraph.ir_arch = machine.ira(loc_db)

◆ IRA

depgraph.IRA = IRATest(loc_db)

◆ ircfg

depgraph.ircfg = ir_arch.new_ircfg_from_asmcfg(asmcfg)

◆ IRDst

depgraph.IRDst = IRA.IRDst

◆ json_solutions

list depgraph.json_solutions = []

◆ LBL0

depgraph.LBL0 = loc_db.add_location("lbl0", 0)

◆ LBL1

depgraph.LBL1 = loc_db.add_location("lbl1", 1)

◆ LBL2

depgraph.LBL2 = loc_db.add_location("lbl2", 2)

◆ LBL3

depgraph.LBL3 = loc_db.add_location("lbl3", 3)

◆ LBL4

depgraph.LBL4 = loc_db.add_location("lbl4", 4)

◆ LBL5

depgraph.LBL5 = loc_db.add_location("lbl5", 5)

◆ LBL6

depgraph.LBL6 = loc_db.add_location("lbl6", 6)

◆ loc_db

depgraph.loc_db = LocationDB()

◆ machine

depgraph.machine = Machine(arch)

◆ mdis

depgraph.mdis = machine.dis_engine(cont.bin_stream, dont_dis_nulstart_bloc=True, loc_db=loc_db)

◆ mode_suffix

list depgraph.mode_suffix = suffix_key_list[g_ind]

◆ nargs

depgraph.nargs

◆ parser

depgraph.parser = ArgumentParser("Dependency grapher")

◆ PC

depgraph.PC = ExprId("pc", 32)

◆ R

depgraph.R = ExprId("r", 32)

◆ regs

depgraph.regs = machine.mn.regs.all_regs_ids_byname

◆ result

string depgraph.result = ", ".join("=".join(x) for x in viewitems(tokens))

◆ results

depgraph.results = sol.emul(ir_arch, ctx=init_ctx)

◆ sat

depgraph.sat = sol.is_satisfiable

◆ SP

depgraph.SP = ExprId("sp", 32)

◆ STEP_COUNTER

depgraph.STEP_COUNTER = count()

◆ suffix_key_list

list depgraph.suffix_key_list
Initial value:
1 = ["", "_nosimp", "_nomem", "_nocall",
2  "_implicit"]

◆ target_addr

depgraph.target_addr = int(args.target_addr, 0)

◆ test_num

depgraph.test_num

◆ test_results

list depgraph.test_results
Initial value:
1 = [[unflatGraph(flat_result) for flat_result in flat_results]
2  for flat_results in flat_test_results]

◆ tokens

dictionary depgraph.tokens = {str(k): str(v) for k, v in viewitems(results)}
depgraph.gen_irblock
def gen_irblock(label, exprs_list)
Definition: depgraph.py:60
depgraph.unflatGraph
def unflatGraph(flat_graph)
Definition: depgraph.py:779