def test_add_xref(self): sdbgen = SDBGen(':memory:') sdbgen.add_line(0x051FECB4, LineTypes.CODE,'li r25,0','\x3B\x20\x00\x00') sdbgen.add_line(0x051FECB8, LineTypes.CODE, 'addi r24, r1, 0x40+var_28','\x3B\x01\x00\x18') sdbgen.add_xref(XrefTypes.CODE_FLOW,0x051fecb4,0x051fecb8) sdbgen.fill_lines_fts() sdbgen.close()
def fill_sdb(sdb_path): """ Fill the database with some example rows. """ sdbgen = SDBGen(sdb_path) sdbgen.add_line(0x051FECB4, LineTypes.CODE, 'li r25,0', '\x3B\x20\x00\x00') sdbgen.add_line(0x051FECB8, LineTypes.CODE, 'addi r24, r1, 0x40+var_28', '\x3B\x01\x00\x18') sdbgen.add_line(0x051FECBC, LineTypes.CODE, 'bctrl', '\x4e\x80\x04\x21') sdbgen.add_line(0x051FECC0, LineTypes.CODE, 'li r4,-1', '\x38\x80\xff\xff') sdbgen.add_line(0x051FECC4, LineTypes.CODE, 'li r5,-1', '\x38\xA0\xff\xff') sdbgen.add_line(0xFF000000, LineTypes.CODE, 'empty', '') sdbgen.add_xref(XrefTypes.CODE_FLOW, 0x051fecb4, 0x051fecb8) sdbgen.add_function(0x051fecb4, 'my_func', [0x051fecb4, 0x051fecb8]) sdbgen.fill_lines_fts() sdbgen.close()