This is a question on the internals of the TeX system rather than on how to use it. Every time an undefined control sequence is used in a document, TeX prints the message
undefined control sequence [<code>]
where <code> is usually an excerpt from the code that contains the actual control sequence that caused the error.
Many times, however, it seems TeX cannot give us a precise error messages. It often happens in beamer presentations, for example, where all we get is
undefined control sequence [\end{frame}]
Of course, in this example, \end is defined, and the problem lies in some piece of code inside the environment. This often happens also with undefined control sequences expanded from complicated macros.
I understand that this behavior probably comes from the intricacies of how tokens get expanded in the frame environment, but since TeX itself is expanding the tokens, how hard can it be to print the name of the actual undefined control sequence? This could be immensely useful for debugging purposes.
So is there a technical reason why TeX does not print which is the control sequence which is actually undefined, or is it like this on purpose?
\errorcontextlines=100(or some large number like that) will show all. Please post a concrete example that can be used to illustrate answers. – ShreevatsaR Nov 02 '17 at 03:52\showand\showtheto print the definition of macros and\wlogto write a log file during compilation. – Christian Nov 03 '17 at 07:48