Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
Zipr Toolchain
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Open Source Software
Zipr Toolchain
Commits
787e8ec3
Commit
787e8ec3
authored
6 years ago
by
Jason Hiser
Browse files
Options
Downloads
Patches
Plain Diff
support stop/dump before/after
Former-commit-id: 9be1c67c21b5ffc7be5ec9b2baf295b31f6a4462
parent
8cba86e4
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/ps_analyze.sh
+30
-12
30 additions, 12 deletions
tools/ps_analyze.sh
with
30 additions
and
12 deletions
tools/ps_analyze.sh
+
30
−
12
View file @
787e8ec3
...
@@ -10,7 +10,8 @@
...
@@ -10,7 +10,8 @@
source
$(
dirname
$0
)
/ps_wrapper.source
$0
source
$(
dirname
$0
)
/ps_wrapper.source
$0
realpath
()
{
realpath
()
{
\c
d
"
$1
"
\c
d
"
$1
"
/bin/pwd
/bin/pwd
}
}
...
@@ -568,7 +569,7 @@ perform_step()
...
@@ -568,7 +569,7 @@ perform_step()
if
[
"
$step
"
=
"
$stop_before_step
"
]
;
then
if
[
"
$step
"
=
"
$stop_before_step
"
]
;
then
echo
"ps_analyze has been asked to stop before step
$step
."
echo
"ps_analyze has been asked to stop before step
$step
."
echo
"command is:
$command
"
echo
"command is:
LD_LIBRARY_PATH=
$SECURITY_TRANSFORMS_HOME
/lib gdb --args
$command
"
exit
1
exit
1
fi
fi
if
[
"
$step
"
=
"
$dump_before_step
"
]
;
then
if
[
"
$step
"
=
"
$dump_before_step
"
]
;
then
...
@@ -693,7 +694,7 @@ perform_step()
...
@@ -693,7 +694,7 @@ perform_step()
if
[
"
$step
"
=
"
$stop_after_step
"
]
;
then
if
[
"
$step
"
=
"
$stop_after_step
"
]
;
then
echo
"ps_analyze has been asked to stop after step
$step
."
echo
"ps_analyze has been asked to stop after step
$step
."
echo
"command is:
$command
"
echo
"command is:
LD_LIBRARY_PATH=
$SECURITY_TRANSFORMS_HOME
/lib gdb --args
$command
"
exit
1
exit
1
fi
fi
if
[
"
$step
"
=
"
$dump_after_step
"
]
;
then
if
[
"
$step
"
=
"
$dump_after_step
"
]
;
then
...
@@ -703,6 +704,18 @@ perform_step()
...
@@ -703,6 +704,18 @@ perform_step()
return
$command_exit
return
$command_exit
}
}
run_current_thanos_steps
()
{
# echo "Doing thanos steps: $thanos_plugins"
# execute last block of thanos plugins if there are any left
if
[[
$thanos_plugins
]]
;
then
perform_step
"
$thanos_steps
"
none
"
$plugin_path
/thanos.exe "
$thanos_plugins
""
thanos_plugins
=
""
thanos_steps
=
""
fi
}
do_plugins
()
do_plugins
()
{
{
...
@@ -744,9 +757,14 @@ do_plugins()
...
@@ -744,9 +757,14 @@ do_plugins()
plugin_path
=
$SECURITY_TRANSFORMS_HOME
/plugins_install/
plugin_path
=
$SECURITY_TRANSFORMS_HOME
/plugins_install/
# first check if step can be invoked as a thanos plugin
# first check if step can be invoked as a thanos plugin
if
[
-x
$plugin_path
/lib
$stepname
.so
]
;
then
if
[
-x
$plugin_path
/lib
$stepname
.so
]
;
then
# if this step is a stop before/after step, cleanup anything outstanding so we can do the one step special.
if
[[
$stepname
==
$stop_before_step
]]
||
[[
$stepname
==
$stop_after_step
]]
||
[[
$stepname
==
$dump_before_step
]]
||
[[
$stepname
==
$dump_after_step
]]
;
then
run_current_thanos_steps
fi
# add step to the block of contiguous thanos plugins
# add step to the block of contiguous thanos plugins
stop_if_error
$stepname
stop_if_error
$stepname
if
[[
$?
-gt
$error_threshold
]]
;
then
if
[[
$?
-gt
$error_threshold
]]
;
then
...
@@ -755,12 +773,16 @@ do_plugins()
...
@@ -755,12 +773,16 @@ do_plugins()
thanos_plugins
=
"
$thanos_plugins
\"
$stepname
-optional --step-args
$cloneid
$value
\"
"
thanos_plugins
=
"
$thanos_plugins
\"
$stepname
-optional --step-args
$cloneid
$value
\"
"
fi
fi
thanos_steps
=
"
$thanos_steps
$stepname
"
thanos_steps
=
"
$thanos_steps
$stepname
"
# if this step is a stop before/after step, do it special, so we exit early.
if
[[
$stepname
==
$stop_before_step
]]
||
[[
$stepname
==
$stop_after_step
]]
;
then
perform_step
$stepname
none
"
$plugin_path
/thanos.exe --no-redirect "
$thanos_plugins
""
elif
[[
$stepname
==
$dump_before_step
]]
||
[[
$stepname
==
$dump_after_step
]]
;
then
perform_step
$stepname
none
"
$plugin_path
/thanos.exe "
$thanos_plugins
""
fi
continue
continue
elif
[[
$thanos_steps
]]
;
then
elif
[[
$thanos_steps
]]
;
then
# execute preceding block of thanos plugin steps now
# execute preceding block of thanos plugin steps now
perform_step
"
$thanos_steps
"
none
"
$plugin_path
/thanos.exe "
$thanos_plugins
""
run_current_thanos_steps
thanos_plugins
=
""
thanos_steps
=
""
fi
fi
# invoke .exe, or .sh as a plugin step
# invoke .exe, or .sh as a plugin step
...
@@ -779,11 +801,7 @@ do_plugins()
...
@@ -779,11 +801,7 @@ do_plugins()
done
done
# execute last block of thanos plugins if there are any left
# execute last block of thanos plugins if there are any left
if
[[
$thanos_plugins
]]
;
then
run_current_thanos_steps
perform_step
"
$thanos_steps
"
none
"
$plugin_path
/thanos.exe "
$thanos_plugins
""
thanos_plugins
=
""
thanos_steps
=
""
fi
}
}
...
...
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