How to get unfolded disassembly text in idapython?

Hi,
I know gen_disasm_text can be used to fetch disasm text from address [start, end), but looks like it will not auto unfold the item. Also is there any way I can get disasm text line by line from a address?

hello @s0duku , I will ask around and let you know shortly if there’s a way to do that.

Alas, it seems to be not possible without expanding the collapsed areas, but you should be able to do it using get_hidden_range/update_hidden_range functions.

Maybe tell us what you are trying to achieve. Trying to parse the disassembly text is usually the more cumbersome approach. For an example see Writing a simple x86 emulator with IDAPython | Shortjump!

1 Like

Thanks for help
However, when I test get_hidden_range, it not work. For example, I click the arrow at the start address of the function to fold the disassembled content of the function then use get_hidden_range on that address, It returns None

I’m trying to use LLM to analyze, so I believe the original text format disassembly could be more helpful

Thank you for checking! Indeed, get_hidden_range only works for ranges which are not functions or segments. For functions, you need to use set_visible_func(), and for segments set_visible_segm().

Thank you for the reminder. By the way, may I ask where I can get a list of availiable IDA UI action names for process_ui_action, for example click the Unhide All.

Please check cfg/idagui.cfg.

You can call idaapi.get_registered_actions().

1 Like