plugins/elf: Update for aspace.analisys_stack_push() signature change.
[ScratchABit.git] / actions.py
blobf1be3610157ec58c1aa068804e94857f41adea03
1 import engine
4 class TextSaveModel:
5 def __init__(self, f, ctrl=None):
6 self.f = f
7 self.ctrl = ctrl
8 self.cnt = 0
9 def add_line(self, addr, line):
10 line = ("%08x " % addr) + line.indent + line.render() + "\n"
11 self.f.write(line)
12 if self.ctrl and self.cnt % 256 == 0:
13 self.ctrl.show_status("Writing: 0x%x" % addr)
14 self.cnt += 1
16 def write_func(APP, addr, prefix="", feedback_obj=None):
17 func = APP.aspace.lookup_func(addr)
18 if func:
19 funcname = APP.aspace.get_label(func.start)
20 outfile = prefix + funcname + ".lst"
21 with open(outfile, "w") as f:
22 model = TextSaveModel(f, feedback_obj)
23 for start, end in func.get_ranges():
24 while start < end:
25 start = engine.render_from(model, start, 1)
26 return outfile