Vector35 / binaryninja-api

Public API, examples, documentation and issues for Binary Ninja
https://binary.ninja/
MIT License
899 stars 203 forks source link

`DisassemblyTextRenderer.get_instruction_annotations` is broken #5860

Open negasora opened 1 month ago

negasora commented 1 month ago

It was a victim of a refactor and now always returns an empty list

fuzyll commented 1 month ago

Here is a workaround that appears to work:

r = DisassemblyTextRenderer(current_function)
tokens = list(r.get_disassembly_text(here))[0][0].tokens
in_annotation = False
out = ""
for i in tokens:
    if i.type == InstructionTextTokenType.AnnotationToken:
        in_annotation = True
        continue
    if in_annotation:
        out += i.text
print(out)

We should still fix the API, though.