This is an archive of the discontinued LLVM Phabricator instance.

[Support] Always wait for GraphViz before opening the viewer
ClosedPublic

Authored by Meinersbur on Aug 8 2015, 12:45 PM.

Details

Summary

When calling DisplayGraph and a PS viewer is chosen, two programs are executed: The GraphViz generator and the PostScript viewer. Always for the generator to finish to ensure that the .ps file is written before opening the viewer for that file. DisplayGraph's wait parameter refers to whether to wait until the user closes the viewer.

This happened on Windows and if none of the options to open the .dot file directly applies, also on Linux.

Diff Detail

Repository
rL LLVM

Event Timeline

Meinersbur updated this revision to Diff 31597.Aug 8 2015, 12:45 PM
Meinersbur retitled this revision from to [Support] Always wait for GraphViz before opening the viewer.
Meinersbur updated this object.
Meinersbur added reviewers: Bigcheese, chandlerc.
Meinersbur set the repository for this revision to rL LLVM.
Meinersbur added a subscriber: llvm-commits.

Will this cause incorrect behavior on non-Windows platforms where wait was false, but now causes the wait to happen. Specifically, I'm wondering about callers of ViewGraph().

~Aaron

This looks good to me. I do however not have commit rights which means I can't give an official approval. I did encounter the issue this patch fixes when testing the changes in D11877.

A suggestion for a follow-up patch is to rename "ExecGraphViewer" since it's used both for generation and viewing of the graph which can be a bit confusing.

Will this cause incorrect behavior on non-Windows platforms where wait was false, but now causes the wait to happen. Specifically, I'm wondering about callers of ViewGraph().

I'd say the old behavior is incorrect on all platforms. If GraphViz takes longer to execute than it takes for the viewer to launch, it won't work on any system. I don't know why this is much more likely to happen on Windows.

I am working on Linux as well and it works nicely there. I don't know about MacOS as I don't have an Apple.

aaron.ballman accepted this revision.Aug 17 2015, 5:11 PM
aaron.ballman added a reviewer: aaron.ballman.

I would guess that testing this is prohibitively problematic, but the logic seems sound. LGTM!

This revision is now accepted and ready to land.Aug 17 2015, 5:11 PM

I guess nobody notices this yet because Linux systems have xdg-open which will handle the .dot file directly ("open" on OSX). Forcing using a ps viewer also opens the viewer before the file has been generated on Linux.

Meinersbur updated this object.Aug 18 2015, 5:13 AM
Meinersbur edited edge metadata.
Meinersbur closed this revision.Aug 18 2015, 5:14 AM