#include <kernwin.hpp> // For get_screen_ea() definition
#include <lines.hpp> // For tag_remove() and generate_disasm_line()
#include <xref.hpp>
xrefblk_t xb;
ea_t addr = get_screen_ea();
// Replicate IDA 'x' keyword functionality
for (bool res = xb.first_to(addr, XREF_FAR); res; res = xb.next_to())
{
char buf[MAXSTR];
char clean_buf[MAXSTR];
// Get the disassembly text for the referencing addr
generate_disasm_line(xb.from, buf, sizeof(buf)-1);
// Clean out any format or colour codes
tag_remove(buf, clean_buf, sizeof(clean_buf) - 1);
msg("%a: %s\n", xb.from, clean_buf);
}