Skip to content

Commit

Permalink
[WIP] Wire up some more
Browse files Browse the repository at this point in the history
Co-authored-by: Håvard Sørbø <havard@hsorbo.no>
  • Loading branch information
oleavr and hsorbo committed Sep 21, 2023
1 parent e9ee8fa commit d3b012f
Show file tree
Hide file tree
Showing 2 changed files with 23,818 additions and 0 deletions.
37 changes: 37 additions & 0 deletions tests/core/swiftapiresolver/mkflamegraph.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/sh

instruments_profile=$1
agent_base=$2
tests_base=$3
if [ -z "$instruments_profile" -o -z "$agent_base" -o -z "$tests_base" ]; then
echo "Usage: $0 <instruments-profile> <agent-base> <tests-base> <output-svg>" > /dev/stderr
exit 1
fi

tests=$(dirname "$0")
repo=$(dirname $(dirname $(dirname "$tests")))
buildpfx=../build/tmp-macos-arm64
flamegraph=~/src/FlameGraph

cd "$repo"

set -ex

intdir=$(mktemp -d /tmp/mkflamegraph.XXXXXX)
stacks_symbolicated=$intdir/stacks_symbolicated
stacks_folded=$intdir/stacks_folded

clean_up () {
rm -rf "$intdir"
}
trap clean_up EXIT

"$repo/tools/symbolicate.py" \
--input "$instruments_profile" \
--output "$stacks_symbolicated" \
--declare-module $buildpfx/frida-core/lib/agent/libfrida-agent-modulated.dylib:$agent_base \
--declare-module $buildpfx/frida-gum/tests/core/swiftapiresolver/libtestswiftapiresolver.dylib:$tests_base
"$flamegraph/stackcollapse-instruments.pl" "$stacks_symbolicated" \
| grep gum_script_scheduler_run_js_loop \
> "$stacks_folded"
"$flamegraph/flamegraph.pl" "$stacks_folded"
Loading

0 comments on commit d3b012f

Please sign in to comment.