summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Buhot <thomas.buhot@intel.com>2016-01-27 09:44:31 +0100
committerDan Liang <dan.liang@intel.com>2016-02-05 16:47:19 +0800
commita2c228770ea1cadc1d06406baad899b8c500389a (patch)
treec11ddb9975357dee5a4d791b96034a93acdab447
parent259eb56171420f62be325eadc38673d967527ab6 (diff)
downloadframeworks_native-a2c228770ea1cadc1d06406baad899b8c500389a.zip
frameworks_native-a2c228770ea1cadc1d06406baad899b8c500389a.tar.gz
frameworks_native-a2c228770ea1cadc1d06406baad899b8c500389a.tar.bz2
Enable wildcard in the list of kernel functions
The handling of the -k option is too restrictive as it stricly checks the names of the kernel functions after it wrote them in /d/tracing/set_ftrace_filter. However, a common usage of that function filtering with ftrace is to use a wildcard character (*) that the ftrace tracer automatically expands to all the matching kernel functions. This enables the support of the wildcard (*) character in the -k option to trace kernel functions. Change-Id: Ifffae975c20e1c253157a3a6b44a14b4f342b9d0 Signed-off-by: Thomas Buhot <thomas.buhot@intel.com> Signed-off-by: Zhiquan Liu <zhiquan.liu@intel.com>
-rw-r--r--cmds/atrace/atrace.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/cmds/atrace/atrace.cpp b/cmds/atrace/atrace.cpp
index 81c8967..6549dde 100644
--- a/cmds/atrace/atrace.cpp
+++ b/cmds/atrace/atrace.cpp
@@ -545,17 +545,19 @@ static bool verifyKernelTraceFuncs(const char* funcs)
String8 funcList = String8::format("\n%s", buf);
// Make sure that every function listed in funcs is in the list we just
- // read from the kernel.
+ // read from the kernel, except for wildcard inputs.
bool ok = true;
char* myFuncs = strdup(funcs);
char* func = strtok(myFuncs, ",");
while (func) {
- String8 fancyFunc = String8::format("\n%s\n", func);
- bool found = funcList.find(fancyFunc.string(), 0) >= 0;
- if (!found || func[0] == '\0') {
- fprintf(stderr, "error: \"%s\" is not a valid kernel function "
- "to trace.\n", func);
- ok = false;
+ if (!strchr(func, '*')) {
+ String8 fancyFunc = String8::format("\n%s\n", func);
+ bool found = funcList.find(fancyFunc.string(), 0) >= 0;
+ if (!found || func[0] == '\0') {
+ fprintf(stderr, "error: \"%s\" is not a valid kernel function "
+ "to trace.\n", func);
+ ok = false;
+ }
}
func = strtok(NULL, ",");
}