Skip to content

Output g2html directly #1752

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 82 commits into
base: master
Choose a base branch
from
Open

Output g2html directly #1752

wants to merge 82 commits into from

Conversation

sim642
Copy link
Member

@sim642 sim642 commented May 23, 2025

Currently for the g2html output Goblint produces:

  1. One massive XML file with all results.
  2. .dot files for all function CFGs.

Then g2html takes those and does the following:

  1. Splits the massive XML file into individual XML files for nodes, files, globals, warnings.
  2. Runs Graphviz on all the .dot files to get .svg files.
  3. Copies some static resources to the output directory: XML transformers, CSS styles, some JS and fonts.

This PR shows that we can easily cut out the middle man and get rid of the Java-based g2html altogether by doing the following directly in Goblint:

  1. Producing the individual XML files.
  2. Producing the .dot files and also running Graphviz on them.
  3. Copying the same static stuff.

The result is almost exactly the same HTML-like results viewing experience.

The only difference is that g2html includes a custom lexer for unpreprocessed C that's used for highlighting code in the g2html file view. This remake doesn't do highlighting, but I don't know if anyone even looks at the file view in g2html.
I think it's a minor loss for what otherwise allows us to get rid of an ancient Java-based component which just wastes time copying XML around and reconstructing liveness information.
Doing the same directly in OCaml means that this output is also available to Goblint installed via opam itself, where otherwise g2html isn't present.

TODO

  • Add syntax highlighting. Maybe using Pygments?
  • Remove old single-XML output? Let's keep it for now as as possible fallback for when the new approach does fail.
  • Clean up new implementation code.

kalmera and others added 30 commits March 2, 2014 21:24
This rolls back to commit 760e44a8f8abe89031109cc5ee8506cafad8fff6.
tried new version, but seems like there is no option to disable the animation
Index (position()) based lookup breaks if XML doesn't contain analyses in same order for each global variable.
Somehow broke now and filtered too much.
@sim642 sim642 marked this pull request as ready for review July 25, 2025 08:24
@sim642
Copy link
Member Author

sim642 commented Jul 25, 2025

I've now added syntax highlighting with Pygments, so this now should be able to completely replace g2html.
I'm trying to do some benchmarking on the HTML results generation part to give a better view of the effect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup Refactoring, clean-up performance Analysis time, memory usage setup Dependencies, CI, releasing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants