Skip to content

Add an option to show library classes' graphs in visualization #947

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

Merged
merged 1 commit into from
Sep 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,13 @@ object UtSettings : AbstractSettings(
*/
val copyVisualizationPathToClipboard get() = useDebugVisualization

/**
* Set the value to true to show library classes' graphs in visualization.
*
* False by default.
*/
val showLibraryClassesInVisualization by getBooleanProperty(false)

/**
* Method is paused after this timeout to give an opportunity other methods
* to work
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import org.utbot.engine.isReturn
import org.utbot.engine.selectors.PathSelector
import org.utbot.engine.stmts
import org.utbot.framework.UtSettings.copyVisualizationPathToClipboard
import org.utbot.framework.UtSettings.showLibraryClassesInVisualization
import soot.jimple.Stmt
import soot.toolkits.graph.ExceptionalUnitGraph
import java.awt.Toolkit
Expand Down Expand Up @@ -103,7 +104,11 @@ class GraphViz(
graph.allEdges.forEach { edge ->
val (edgeSrc, edgeDst, _) = edge

if (stmtToSubgraph[edgeSrc] !in libraryGraphs && stmtToSubgraph[edgeDst] !in libraryGraphs) {
val srcInLibraryMethod = stmtToSubgraph[edgeSrc] in libraryGraphs
val dstInLibraryMethod = stmtToSubgraph[edgeDst] in libraryGraphs
val edgeIsRelatedToLibraryMethod = srcInLibraryMethod || dstInLibraryMethod

if (!edgeIsRelatedToLibraryMethod || showLibraryClassesInVisualization) {
dotGlobalGraph.addDotEdge(edge)
}
}
Expand Down Expand Up @@ -143,8 +148,10 @@ class GraphViz(
}

// Filter library methods
uncompletedStack.removeIf { it.name in libraryGraphs }
fullStack.removeIf { it.name in libraryGraphs }
if (!showLibraryClassesInVisualization) {
uncompletedStack.removeIf { it.name in libraryGraphs }
fullStack.removeIf { it.name in libraryGraphs }
}

// Update nodes and edges properties
dotGlobalGraph.updateProperties(executionState)
Expand Down