This seems to work:
https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/list-of-xrefs/td-p/1898983
So, it depends what you want.
I made "a.dwg", "b.dwg", "c.dwg", "d.dwg"
"b.dwg" has 2 xrefs attached: "c.dwg" as attached xref, and "d.dwg" as overlay XREF.
Now on "a.dwg" I attach "b.dwg"
"c.dwg" will appear in the XREFS in "a.dwg", "d.dwg" will not. THat's exactly what ATTACH/OVERLAY is intended for.
So, what my scrip here below does, is list the XREFS as they are listed in the XREFS pane. Are you happy with this?
Anything more you want with this?
;=======================================================================
;;Make and sort table of xref's
;;
(defun TXREF (/ tst1 LXREF LXREFPATH)
(setq MTBLE (tblnext "block" t) LXREF nil)
(while (/= MTBLE nil)
(setq tst1 (assoc 1 MTBLE)); path of xref
(if (/= tst1 nil)
(progn
(setq LXREF (append LXREF (list (cdr (assoc 2 MTBLE))))) ;xref name
(setq LXREFPATH (append LXREFPATH (list (cdr (assoc 1 MTBLE))))) ;xref name
);end progn
);end if
(setq MTBLE (tblnext "block"))
);end while
(list LXREF LXREFPATH) ;; returns a list of the XREF name; then a list of the XREF paths
);end defun
(defun c:test ( / xrefs)
(setq xrefs (TXREF))
(princ xrefs)
(princ)
)