예제 #1
0
def main():

    if len(argv) < 3:
        print "Usage : %s <number of instrucitons> <filename>" % argv[0]
        return

    analyzer = Analyzer(argv[1])

    da = Disassembler()
    da.disassemble(analyzer, argv[2])
예제 #2
0
 def getDisassembly(self):
   if hasattr(self, "disassembly"):
     return self.disassembly
   vfile = self.node.open()
   content = vfile.read()
   vfile.close()
   disassembler = Disassembler()
   try:
     self.disassembly = ("%s - " % (self.node.name()) + disassembler.disassemble(content)).split('\n')
   except Exception as e:
     self.stateinfo = e
     self.disassembly = ["Unable to disassemble file: %s" % e] # TODO: do not show the disassembly window
   return self.disassembly
예제 #3
0
def test_disasm(
    addr,
    show_strings = False,
    show_line_addrs = False,
    no_pointer = False,
    cpp_macros = False,
    map_path = "R8PP01.map",
    dump_path = "ram.raw",
    spm = True,
    recursive = False
):
    ctx = DummyConfig(show_strings, show_line_addrs, no_pointer, cpp_macros, map_path, dump_path, spm, recursive)
    dis = Disassembler(ctx)
    return dis.disassemble(addr)
예제 #4
0
def main():
    ctx = Config()
    dis = Disassembler(ctx)
    txt = dis.disassemble(ctx.addr)
    stdout.buffer.write(txt.encode("utf8")) # TODO: is there a better way to fix this?