TeX of course knows at any time what control words and symbols are defined. Is it possible to access this information, for example at the end of a run?
Edit: the answer for pdfTeX is no, since the list of control sequence names is only stored in the string pool, which is not accessible from the TeX run. The answer for XeTeX is currently yes, because of a bug (see my answer). The answer in LuaTeX is probably yes, but it would be great to have an actual implementation.
I will thus have to do what I planned differently (for this, the
cmdtrack package should help).
What I wanted to use the list of macros for is essentially a duplicate of this question: expanding some macros inside the LaTeXsource.