def update_disassembly(self):
if not self.should_update():
return
pc = parse_result_line(run_cmd("-data-evaluate-expression $pc", True))["value"]
if " " in pc:
pc = pc[:pc.find(" ")]
pc = int(pc, 16)
if not (pc >= self.start and pc <= self.end):
l = run_cmd("-data-disassemble -s \"$pc-32\" -e \"$pc+200\" -- 1", True)
asms = parse_result_line(l)
self.clear()
if get_result(l) != "error":
asms = asms["asm_insns"]
if "src_and_asm_line" in asms:
l = listify(asms["src_and_asm_line"])
for src_asm in l:
line = src_asm["line"]
file = src_asm["file"]
self.add_line("%s:%s\n" % (file, line))
self.add_insns(src_asm["line_asm_insn"])
else:
self.add_insns(asms)
self.update()
view = self.get_view()
reg = view.find("^0x[0]*%x:" % pc, 0)
if reg is None:
view.erase_regions("sublimegdb.programcounter")
else:
pos_scope = get_setting("position_scope", "entity.name.class")
pos_icon = get_setting("position_icon", "bookmark")
view.add_regions("sublimegdb.programcounter",
[reg],
pos_scope, pos_icon, sublime.HIDDEN)
评论列表
文章目录