install_user_defined_prefix

summary: insert information into listing prefixes

description:

By default, disassembly line prefixes contain segment + address information (e.g., ‘.text:08047718’), but it is possible to “inject” other bits of information in there, thanks to the ida_lines.user_defined_prefix_t helper type.

level: beginner

Attributes

PREFIX

Classes

my_user_prefix_t

prefix_plugin_t

Base class for all scripted plugins.

Functions

PLUGIN_ENTRY()

Module Contents

install_user_defined_prefix.PREFIX
class install_user_defined_prefix.my_user_prefix_t(*args)

Bases: ida_lines.user_defined_prefix_t

get_user_defined_prefix(ea, insn, lnnum, indent, line)

This callback must be overridden by the derived class.

Parameters:
  • ea – the current address

  • insn – the current instruction. if the current item is not an instruction, then insn.itype is zero.

  • lnnum – number of the current line (each address may have several listing lines for it). 0 means the very first line for the current address.

  • indent – see explanations for gen_printf()

  • line – the line to be generated. the line usually contains color tags. this argument can be examined to decide whether to generate the prefix.

class install_user_defined_prefix.prefix_plugin_t

Bases: ida_idaapi.plugin_t

Base class for all scripted plugins.

flags = 0
comment = 'This is a user defined prefix sample plugin'
help = 'This is help'
wanted_name = 'user defined prefix'
wanted_hotkey = ''
prefix = None
init()
run(arg)
term()
install_user_defined_prefix.PLUGIN_ENTRY()