-
Notifications
You must be signed in to change notification settings - Fork 12.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[analyzer] exploded-graph-rewriter: Initial commit.
This is a utility to improve readability and generally manipulate GraphViz dumps of the analysis graph. Such dumps are often huge and not only hard to read, but also often hang the viewer apps with their mere size. Such script should significantly improve debugging experience. Differential Revision: https://reviews.llvm.org/D62638 llvm-svn: 362340
- Loading branch information
Showing
7 changed files
with
584 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// RUN: %exploded_graph_rewriter %s | FileCheck %s | ||
|
||
Node0x1 [shape=record,label= | ||
"{{ "node_id": 1, "pointer": "0x1", | ||
"program_state": null, "program_points": []}\l}"]; | ||
|
||
// CHECK: Node0x1 -> Node0x2; | ||
Node0x1 -> Node0x2; | ||
|
||
Node0x2 [shape=record,label= | ||
"{{ "node_id": 2, "pointer": "0x2", | ||
"program_state": null, "program_points": []}\l}"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// RUN: %exploded_graph_rewriter %s | FileCheck %s | ||
|
||
digraph "Exploded Graph" { | ||
label="Exploded Graph"; | ||
} | ||
|
||
// CHECK: digraph "ExplodedGraph" { | ||
// CHECK-NEXT: label=""; | ||
// CHECK-NEXT: } |
50 changes: 50 additions & 0 deletions
50
clang/test/Analysis/exploded-graph-rewriter/environment.dot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// RUN: %exploded_graph_rewriter %s | FileCheck %s | ||
|
||
// CHECK: <b>Environment: </b> | ||
// CHECK-SAME: <table border="0"> | ||
// CHECK-SAME: <tr> | ||
// CHECK-SAME: <td align="left"> | ||
// CHECK-SAME: <b>#0 Call</b> | ||
// CHECK-SAME: </td> | ||
// CHECK-SAME: <td align="left"> | ||
// CHECK-SAME: <font color="grey60">foo </font>(line 4) | ||
// CHECK-SAME: </td> | ||
// CHECK-SAME: </tr> | ||
// CHECK-SAME: <tr> | ||
// CHECK-SAME: <td align="left"> | ||
// CHECK-SAME: <i>S5</i> | ||
// CHECK-SAME: </td> | ||
// CHECK-SAME: <td align="left"> | ||
// CHECK-SAME: bar() | ||
// CHECK-SAME: </td> | ||
// CHECK-SAME: <td align="left"> | ||
// CHECK-SAME: Unknown | ||
// CHECK-SAME: </td> | ||
// CHECK-SAME: </tr> | ||
// CHECK-SAME: </table> | ||
Node0x1 [shape=record,label= | ||
"{ | ||
{ "node_id": 1, | ||
"pointer": "0x1", | ||
"state_id": 2, | ||
"program_points": [], | ||
"program_state": { | ||
"store": null, | ||
"environment": [ | ||
{ | ||
"location_context": "#0 Call", | ||
"lctx_id": 3, | ||
"calling": "foo", | ||
"call_line": 4, | ||
"items": [ | ||
{ | ||
"stmt_id": 5, | ||
"pretty": "bar()", | ||
"value": "Unknown" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} | ||
\l}"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import lit.util | ||
import lit.formats | ||
import os | ||
|
||
use_lit_shell = os.environ.get("LIT_USE_INTERNAL_SHELL") | ||
config.test_format = lit.formats.ShTest(use_lit_shell == "0") | ||
|
||
config.substitutions.append(('%exploded_graph_rewriter', | ||
lit.util.which('exploded-graph-rewriter.py', | ||
os.path.join(config.clang_src_dir, | ||
'utils', 'analyzer')))) | ||
|
||
config.suffixes = ['.dot'] |
60 changes: 60 additions & 0 deletions
60
clang/test/Analysis/exploded-graph-rewriter/program_points.dot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// RUN: %exploded_graph_rewriter %s | FileCheck %s | ||
|
||
// CHECK: <b>Program point:</b> | ||
// CHECK-SAME: <table border="0" align="left" width="0"> | ||
// CHECK-SAME: <tr> | ||
// CHECK-SAME: <td width="0"> | ||
// CHECK-SAME: - | ||
// CHECK-SAME: </td> | ||
// CHECK-SAME: <td align="left" width="0"> | ||
// CHECK-SAME: <font color="gold3">Edge</font> | ||
// CHECK-SAME: </td> | ||
// CHECK-SAME: <td align="left"> | ||
// CHECK-SAME: [B0] -> [B1] | ||
// CHECK-SAME: </td> | ||
// CHECK-SAME: </tr> | ||
// CHECK-SAME: </table> | ||
Node0x1 [shape=record,label= | ||
"{ | ||
{ "node_id": 1, "pointer": "0x1", | ||
"program_state": null, "program_points": [ | ||
{ | ||
"kind": "Edge", | ||
"src_id": 0, | ||
"dst_id": 1, | ||
"terminator": null, | ||
"term_kind": null, | ||
"tag": null } | ||
]} | ||
\l}"]; | ||
|
||
// CHECK-NEXT: <b>Program point:</b> | ||
// CHECK-SAME: <table border="0" align="left" width="0"> | ||
// CHECK-SAME: <tr> | ||
// CHECK-SAME: <td align="left" width="0"> | ||
// CHECK-SAME: (main file):<b>4</b>:<b>5</b>: | ||
// CHECK-SAME: </td> | ||
// CHECK-SAME: <td align="left" width="0"> | ||
// CHECK-SAME: <font color="cyan3">DeclRefExpr</font> | ||
// CHECK-SAME: </td> | ||
// CHECK-SAME: <td>x</td> | ||
// CHECK-SAME: </tr> | ||
// CHECK-SAME: </table> | ||
Node0x2 [shape=record,label= | ||
"{ | ||
{ "node_id": 2, "pointer": "0x2", | ||
"program_state": null, "program_points": [ | ||
{ | ||
"kind": "Statement", | ||
"stmt_kind": "DeclRefExpr", | ||
"stmd_id": 3, | ||
"pointer": "0x3", | ||
"pretty": "x", | ||
"location": { | ||
"line": 4, | ||
"column": 5 | ||
}, | ||
"tag": null | ||
} | ||
]} | ||
\l}"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// RUN: %exploded_graph_rewriter %s | FileCheck %s | ||
|
||
// CHECK: <b>Store: </b> | ||
// CHECK-SAME: <table border="0"> | ||
// CHECK-SAME: <tr> | ||
// CHECK-SAME: <td align="left"> | ||
// CHECK-SAME: x | ||
// CHECK-SAME: </td> | ||
// CHECK-SAME: <td align="left"> | ||
// CHECK-SAME: 0 | ||
// CHECK-SAME: </td> | ||
// CHECK-SAME: <td align="left"> | ||
// CHECK-SAME: (<i>Default</i>) | ||
// CHECK-SAME: </td> | ||
// CHECK-SAME: <td align="left"> | ||
// CHECK-SAME: Undefined | ||
// CHECK-SAME: </td> | ||
// CHECK-SAME: </tr> | ||
// CHECK-SAME: </table> | ||
Node0x1 [shape=record,label= | ||
"{ | ||
{ "node_id": 1, | ||
"pointer": "0x1", | ||
"state_id": 2, | ||
"program_points": [], | ||
"program_state": { | ||
"environment": null, | ||
"store": [ | ||
{ | ||
"cluster": "x", | ||
"items": [ | ||
{ | ||
"kind": "Default", | ||
"offset": 0, | ||
"value": "Undefined" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} | ||
\l}"]; |
Oops, something went wrong.