summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2015-10-24 22:42:42 +0200
committerPeter Wu <peter@lekensteyn.nl>2015-10-24 22:42:42 +0200
commite78d62af91cd264347f9b743f52d57bb999ec20c (patch)
tree5c21c92807e85245bdb4c06c0cc9351be21c5eb8
parent2888f8e1b418208001e93bd488aea452c6f586c1 (diff)
downloadwireshark-notes-e78d62af91cd264347f9b743f52d57bb999ec20c.tar.gz
find-expert-in-tree: add usage
-rwxr-xr-xone-off/find-expert-in-tree11
1 files changed, 10 insertions, 1 deletions
diff --git a/one-off/find-expert-in-tree b/one-off/find-expert-in-tree
index 5c5631b..59e3d24 100755
--- a/one-off/find-expert-in-tree
+++ b/one-off/find-expert-in-tree
@@ -1,6 +1,14 @@
#!/bin/bash
# Searches for functions adding expert items which are located in a if(tree)
# guard. Tested using clang-query 3.7.0 (part of clang-tools-extra).
+#
+# Usage:
+#
+# Ensure that builddir and srcdir variables below are set
+# Ensure that compile_commands.json exists in builddir (see below).
+# Run `./find-expert-in-tree > scan.log` to write matching contexts to file
+# Use the displayed awk command for further processing (see bottom).
+#
# Author: Peter Wu <peter@lekensteyn.nl>
# path to builddir (should contain compile_commands.json, use
@@ -91,7 +99,8 @@ xargs -rt -P$(nproc) -n10 clang-query "${args[@]}"
# -n limits files per command. Use this to tune memory usage.
rm "$tmp"
-cat <<'EOF'
+cat <<'EOF' >&2
+
# Use this for analysis:
awk '/"[r]oot" binds here/{i=3} !/clang-query/&&i>0{printf("%s\033[m\n", $0);i--}' scan.log | less -r
EOF