FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
codeql/javascript/extractor/util/dotify-cfg.sh at main · github/codeql · GitHub
github
codeql
Repository navigation
Code
Issues
1k
(1k)
Pull requests
481
(481)
Discussions
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
codeql
/
javascript
/
extractor
/
util
/
dotify-cfg.sh
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
22 lines (17 loc) · 990 Bytes
Breadcrumbs
codeql
/
javascript
/
extractor
/
util
/
dotify-cfg.sh
Copy path
File metadata and controls
executable file
·
22 lines (17 loc) · 990 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!
/bin/bash
#
Given a trap file, extract the CFG and format it as a DOT digraph
echo
"
digraph {
"
#
Iterate over all tuples in the trap file.
#
#
For tuples of the form `<tablename>(#id, ..., "text")`, record
#
"text (#id)" as a human-readable label for #id. As a special case,
#
for tuples of the form `guard_node(#id1, <outcome>, #id2)` we
#
record "#id2 is <outcome> (#id1)" as a human-readable label for #id1.
#
#
For tuples of the form `successor(#id1, #id2)`, we output an
#
edge from a node labelled with the human-readable label for #id1
#
to a node labelled with the human-readable label for #id2. If no
#
labels have been recorded for either #id1 or #id2, the numeric
#
ids are used instead.
perl -lne
'
print " " . ($labels[$1] || $1) . " -> " . ($labels[$2] || $2) . ";" if /successor\(#(\d+),#(\d+)\)/; $labels[$1] = "$2 (#$1)\"" if /^\w+\(#(\d+),.*,(".*)"\)$/; $labels[$1] = "\"#$3 is $2 (#$1)\"" if /^guard_node\(#(\d+),(\w+),#(\d+)\)$/;
'
$1
|
sed
'
s/\\/\\\\/g
'
echo
"
}
"
Back
|
FazBrowse Home
|
New Git URL