More informative locations in Clean trace of frontend errors
Problem to solve
In !579 (merged) we added infrastructure to log frontend errors. These logs contain a Clean trace from the WebAssembly interpreter. This trace contains addresses like e__iTasks_PExtensions_PGIS_PLeaflet__n__f75_P10431+769 for which the original Clean code is hard to find, especially if they occur in an application in production of which you do not have the generated ABC code any more.
Intended users
Application developers.
Proposal
- Extend the compiler to add source information to ABC files. This can be a simple filename + line number tag for each function, so that you can match
e__iTasks_PExtensions_PGIS_PLeaflet__n__f75_P10431to the corresponding line. (https://gitlab.science.ru.nl/clean-compiler-and-rts/compiler/-/issues/96) - Write a tool that collects source information from all ABC files of a project and writes it to a separate file. (It would be possible to add this to the bytecode symbol table, but this functionality is more general; it can also be used when profiling. Therefore a separate file is a better idea.)
- Call this tool as a separate link step, similar to the bytecode linker and stripper, in cpm / the IDE
- Use this file in iTasks to make the Clean trace more informative.
Note that if you are deploying an application, you are responsible for keeping a version of the code around so that file names and line numbers mean something to you. This only bridges the gap between ABC and Clean code.
Documentation
- General documentation in Documentation (see the files changed in !579 (merged))
- https://top-software.gitlab.io/clean-lang/debugging/symbol-names/ should be updated to at least make reference to the new tool
Acceptance criteria
-
Entries in the Clean trace can be linked to the original Clean code without having to read ABC
Edited by Steffen Michels