Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mockup-generator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dosek-verification
mockup-generator
Commits
d90f1487
Commit
d90f1487
authored
8 years ago
by
Hans-Peter Deifel
Browse files
Options
Downloads
Patches
Plain Diff
Fix --identify-states
parent
15e6bace
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Search/Search.hs
+19
-17
19 additions, 17 deletions
src/Search/Search.hs
with
19 additions
and
17 deletions
src/Search/Search.hs
+
19
−
17
View file @
d90f1487
...
...
@@ -86,11 +86,11 @@ findOpenDecision = listToMaybe . mapMaybe isHalf . M.elems . decisions
driver
::
FilePath
->
Bool
-- ^ Identify states on different locations?
->
IO
()
driver
prog
False
=
driver'
prog
(
Vertex
(
""
,
"start"
)
::
Vertex
'StateAndSyscall
)
driver
prog
True
=
driver'
prog
(
Vertex
(
""
,
"start"
)
::
Vertex
'OnlyState
)
driver
prog
identStates
=
driver'
prog
identStates
(
Vertex
(
""
,
"start"
)
::
Vertex
'StateAndSyscall
)
--
driver prog True = driver' prog (Vertex ("", "start") :: Vertex 'OnlyState)
driver'
::
Ord
(
Vertex
a
)
=>
FilePath
->
Vertex
a
->
IO
()
driver'
prog
startVertex
=
do
driver'
::
Ord
(
Vertex
a
)
=>
FilePath
->
Bool
->
Vertex
a
->
IO
()
driver'
prog
identStates
startVertex
=
do
state
<-
newIORef
(
State
M
.
empty
(
Just
startVertex
)
M
.
empty
[]
)
oneProgRun
prog
state
Nothing
...
...
@@ -99,7 +99,7 @@ driver' prog startVertex = do
findOpenDecision
<$>
readIORef
state
>>=
\
case
Nothing
->
do
s
<-
readIORef
state
T
.
putStrLn
(
graph2Dot
(
graph
s
))
T
.
putStrLn
(
graph2Dot
identStates
(
graph
s
))
exitSuccess
Just
trace
->
oneProgRun
prog
state
(
Just
$
reverse
trace
)
...
...
@@ -167,29 +167,31 @@ handleLine pstdin state = parseLine pstdin >>= \case
NewState
vert
->
modifyIORef
state
(
addVertex
vert
)
>>
return
(
NewState
vert
)
other
->
return
other
graph2Dot
::
Ord
(
Vertex
a
)
=>
Graph
a
->
Text
graph2Dot
graph
=
graph2Dot
::
Ord
(
Vertex
a
)
=>
Bool
->
Graph
a
->
Text
graph2Dot
is
graph
=
"digraph gcfg {
\n
"
<>
dotNodes
graph
<>
dotNodes
is
graph
<>
M
.
foldMapWithKey
nodeStr
graph
<>
"}"
where
nodeStr
from
tos
=
mconcat
$
map
(
arrow
from
)
$
S
.
toList
tos
arrow
from
to
=
" "
<>
nodeId
from
<>
" -> "
<>
nodeId
to
<>
" [label=
\"
"
<>
edgeLabel
(
fst
$
unVertex
from
)
<>
"
\"
];
\n
"
arrow
from
to
=
" "
<>
nodeId
is
from
<>
" -> "
<>
nodeId
is
to
<>
" [label=
\"
"
<>
edgeLabel
(
fst
$
unVertex
from
)
<>
"
\"
];
\n
"
edgeLabel
txt
=
T
.
dropEnd
1
$
T
.
dropWhileEnd
(
/=
'_'
)
$
T
.
drop
(
T
.
length
"OSEKOS_"
)
txt
dotNodes
::
Ord
(
Vertex
a
)
=>
Graph
a
->
Text
dotNodes
=
foldMap
formatNode
.
allNotes
dotNodes
::
Ord
(
Vertex
a
)
=>
Bool
->
Graph
a
->
Text
dotNodes
is
=
foldMap
formatNode
.
allNotes
where
allNotes
m
=
M
.
keysSet
m
`
S
.
union
`
fold
m
formatNode
(
Vertex
(
call
,
state
))
=
nodeId
(
Vertex
(
call
,
state
))
formatNode
(
Vertex
(
call
,
state
))
=
nodeId
is
(
Vertex
(
call
,
state
))
<>
" [label=
\"
"
<>
"State: "
<>
state
<>
"
\\
n"
<>
"
Syscall: "
<>
call
<>
"State: "
<>
state
<>
(
if
not
is
then
"
\\
n
Syscall: "
<>
call
else
mempty
)
<>
"
\"
, shape=box];
\n
"
nodeId
::
Vertex
a
->
Text
nodeId
(
Vertex
(
call
,
state
))
=
"node"
<>
state
<>
"_"
<>
call
nodeId
::
Bool
->
Vertex
a
->
Text
nodeId
False
(
Vertex
(
call
,
state
))
=
"node"
<>
state
<>
"_"
<>
call
nodeId
True
(
Vertex
(
_
,
state
))
=
"node"
<>
state
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment