I’m trying to fetch the results of “jump to xref globally” for a combination of a tinfo_t and an offset. (I know they depend on caching, it is part of an advance xref plugin).
I tried to find xrefs using the following code but no results returned (tid was successfully returned):
def get_udm_index(tif: tinfo_t, udm: udm_t) -> int | None:
"""Get the index of a `udm` in a `tif`"""
index = tif.find_udm(udm, ida_typeinf.STRMEM_OFFSET)
if index == -1:
return None
return index
def tid_from_udm(tif: tinfo_t, udm: udm_t) -> int | None:
"""Get the type ID of a `udm` in a `tif`"""
index = get_udm_index(tif, udm)
if index is None:
return None
return tif.get_udm_tid(index)
def member_xrefs_to(typ: tinfo_t, member: udm_t) -> list[int]:
"""Get all xrefs to the given member of a type"""
tid = tid_from_udm(typ, member)
if tid is None:
return []
return [xref.frm for xref in idautils.XrefsTo(tid, 0)]
