How do I debug BibTeX code? I would like to know how to:
- step through execution,
- step into and out of function calls,
- set breakpoints,
- visualize the stack,
- watch the values of various variables,
et cetera. Are there any debugging options for BibTeX, perhaps like the unravel package (available on CTAN and on GitHub) for LaTeX?
The reason I'm asking such a question is because I have been going through texdoc tamethebeast (Nicolas Markey's Tame the BeaST: The B to X of BibTeX) for a little while now and would like to have a better understanding of what's going on in some of the examples it presents in Chapter 4, particularly some of the later ones (starting around section 20 in said chapter) since they appear to get quite complex. There has to be a better way to go about inspecting how BibTeX code of the like executes and manipulates the stack than writing them out step by step in a sort of annotated textual control-flow graph in a raw text file or — I shudder to think! — getting out pencil and paper! (This last option would be less of a problem if I had room next to the computer from which I'm typing this on the desk it's standing on, but, still, it seems…needlessly archaic, shall I say…?)
$pop, check the values, track them on a piece of paper' is seen as pretty standard ... – Joseph Wright Mar 20 '18 at 21:52web2c(instead of to unreadable Pascal code usingtangle). So I guess the answer is: like TeX, BibTeX can be debugged (poorly) by building it from scratch and running in a debugger. Probably would be easier to just use Biber/BibLaTeX. – ShreevatsaR Mar 20 '18 at 22:33debug,stats, andtraceflags enabled, see https://github.com/texlive/texlive-source/blob/41c7068aea2af2c2684fe08c6d48722a94589e91/extra/bibtex/bibtex.web#L185-L213 – Henri Menke Mar 20 '18 at 22:53traceturned on may be posted as an answer, because the question is really “how can I best debug BibTeX / see what's going on”, rather than asking for a software recommendation (when we all know that no such software exists). – ShreevatsaR Mar 20 '18 at 23:03