Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
ghc-debug
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Glasgow Haskell Compiler
ghc-debug
Commits
a53edfcf
Commit
a53edfcf
authored
1 year ago
by
Matthew Pickering
Browse files
Options
Downloads
Patches
Plain Diff
Update correct OperationalState in async actions
parent
9e7ef441
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#92480
failed
1 year ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ghc-debug-brick/src/Main.hs
+25
-19
25 additions, 19 deletions
ghc-debug-brick/src/Main.hs
with
25 additions
and
19 deletions
ghc-debug-brick/src/Main.hs
+
25
−
19
View file @
a53edfcf
...
...
@@ -856,9 +856,10 @@ inputFooterHandler _ _ _ k re = k re
stringsAction
::
Debuggee
->
EventM
n
OperationalState
()
stringsAction
dbg
=
do
os
<-
get
outside_
os
<-
get
-- TODO: Does not honour search limit at all
asyncAction
"Counting strings"
os
(
stringsAnalysis
Nothing
dbg
)
$
\
res
->
do
asyncAction
"Counting strings"
outside_os
(
stringsAnalysis
Nothing
dbg
)
$
\
res
->
do
os
<-
get
let
cmp
(
k
,
v
)
=
length
k
*
(
S
.
size
v
)
let
sorted_res
=
maybe
id
take
(
_resultSize
os
)
$
Prelude
.
reverse
[(
k
,
S
.
toList
v
)
|
(
k
,
v
)
<-
(
List
.
sortBy
(
comparing
(
S
.
size
.
snd
))
(
M
.
toList
res
))]
...
...
@@ -916,8 +917,9 @@ histogram boxes m =
arrWordsAction
::
Debuggee
->
EventM
n
OperationalState
()
arrWordsAction
dbg
=
do
os
<-
get
asyncAction
"Counting ARR_WORDS"
os
(
arrWordsAnalysis
Nothing
dbg
)
$
\
res
->
do
outside_os
<-
get
asyncAction
"Counting ARR_WORDS"
outside_os
(
arrWordsAnalysis
Nothing
dbg
)
$
\
res
->
do
os
<-
get
let
all_res
=
Prelude
.
reverse
[(
k
,
S
.
toList
v
)
|
(
k
,
v
)
<-
(
List
.
sortBy
(
comparing
(
\
(
k
,
v
)
->
fromIntegral
(
BS
.
length
k
)
*
S
.
size
v
))
(
M
.
toList
res
))]
display_res
=
maybe
id
take
(
_resultSize
os
)
all_res
...
...
@@ -946,7 +948,7 @@ arrWordsAction dbg = do
(
borderWithLabel
(
txt
"Histogram"
)
$
hLimit
100
$
words_histogram
))
tree
=
mkIOTree
dbg
top_closure
g_children
renderArrWordsLines
id
put
(
os
&
resetFooter
put
(
outside_
os
&
resetFooter
&
treeMode
.~
Searched
renderWithHistogram
tree
)
...
...
@@ -954,9 +956,10 @@ data ThunkLine = ThunkLine (Maybe SourceInformation) Count
thunkAnalysisAction
::
Debuggee
->
EventM
n
OperationalState
()
thunkAnalysisAction
dbg
=
do
os
<-
get
outside_
os
<-
get
-- TODO: Does not honour search limit at all
asyncAction
"Counting thunks"
os
(
thunkAnalysis
dbg
)
$
\
res
->
do
asyncAction
"Counting thunks"
outside_os
(
thunkAnalysis
dbg
)
$
\
res
->
do
os
<-
get
let
top_closure
=
Prelude
.
reverse
[
ThunkLine
k
v
|
(
k
,
v
)
<-
(
List
.
sortBy
(
comparing
(
getCount
.
snd
))
(
M
.
toList
res
))]
g_children
_
(
ThunkLine
{})
=
pure
[]
...
...
@@ -979,10 +982,10 @@ thunkAnalysisAction dbg = do
searchWithCurrentFilters
::
Debuggee
->
EventM
n
OperationalState
()
searchWithCurrentFilters
dbg
=
do
os
<-
get
let
mClosFilter
=
uiFiltersToFilter
(
_filters
os
)
asyncAction
"Searching for closures"
os
(
liftIO
$
retainersOf
(
_resultSize
os
)
mClosFilter
Nothing
dbg
)
$
\
cps
->
do
outside_
os
<-
get
let
mClosFilter
=
uiFiltersToFilter
(
_filters
outside_
os
)
asyncAction
"Searching for closures"
outside_
os
(
liftIO
$
retainersOf
(
_resultSize
outside_
os
)
mClosFilter
Nothing
dbg
)
$
\
cps
->
do
os
<-
get
let
cps'
=
map
(
zipWith
(
\
n
cp
->
(
T
.
pack
(
show
n
),
cp
))
[
0
::
Int
..
])
cps
res
<-
liftIO
$
mapM
(
mapM
(
completeClosureDetails
dbg
))
cps'
let
tree
=
mkRetainerTree
dbg
res
...
...
@@ -1033,9 +1036,10 @@ dispatchFooterInput dbg (FFilterClosureSize invert) form = filterOrRun dbg form
dispatchFooterInput
dbg
(
FFilterClosureType
invert
)
form
=
filterOrRun
dbg
form
False
readMaybe
(
pure
.
UIClosureTypeFilter
invert
)
dispatchFooterInput
dbg
(
FFilterCcId
runf
invert
)
form
=
filterOrRun
dbg
form
runf
readMaybe
(
pure
.
UICcId
invert
)
dispatchFooterInput
dbg
(
FProfile
lvl
)
form
=
do
os
<-
get
outside_
os
<-
get
asyncAction
"Writing profile"
os
(
profile
dbg
lvl
(
T
.
unpack
(
formState
form
)))
$
\
res
->
do
asyncAction
"Writing profile"
outside_os
(
profile
dbg
lvl
(
T
.
unpack
(
formState
form
)))
$
\
res
->
do
os
<-
get
let
top_closure
=
Prelude
.
reverse
[
ProfileLine
k
v
|
(
k
,
v
)
<-
(
List
.
sortBy
(
comparing
(
cssize
.
snd
))
(
M
.
toList
res
))]
total_stats
=
foldMap
snd
(
M
.
toList
res
)
...
...
@@ -1078,12 +1082,14 @@ dispatchFooterInput _ FDumpArrWords form = do
SavedAndGCRoots
_
->
act
(
ioTreeSelection
(
view
treeSavedAndGCRoots
os
))
Searched
{}
->
put
(
os
&
footerMessage
"Dump for search mode not implemented yet"
)
dispatchFooterInput
_
FSetResultSize
form
=
do
os
<-
get
asyncAction
"setting result size"
os
(
pure
()
)
$
\
()
->
case
readMaybe
$
T
.
unpack
(
formState
form
)
of
Just
n
|
n
<=
0
->
put
(
os
&
resultSize
.~
Nothing
)
|
otherwise
->
put
(
os
&
resultSize
.~
(
Just
n
))
Nothing
->
pure
()
outside_os
<-
get
asyncAction
"setting result size"
outside_os
(
pure
()
)
$
\
()
->
do
os
<-
get
case
readMaybe
$
T
.
unpack
(
formState
form
)
of
Just
n
|
n
<=
0
->
put
(
os
&
resultSize
.~
Nothing
)
|
otherwise
->
put
(
os
&
resultSize
.~
(
Just
n
))
Nothing
->
pure
()
dispatchFooterInput
dbg
FSnapshot
form
=
do
os
<-
get
asyncAction_
"Taking snapshot"
os
$
snapshot
dbg
(
T
.
unpack
(
formState
form
))
...
...
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