Allow to target atrace apps by glob.

Test: Run trace against "com.google.android.*" and use camera.
Bug: 180021291
Change-Id: I9baa7847476b152284e7557e27f1eba1ee835695
This commit is contained in:
Florian Mayer 2021-02-11 19:31:48 +00:00
parent 3e01373d3a
commit f124707283

View file

@ -21,6 +21,7 @@
#include <errno.h>
#include <fcntl.h>
#include <fnmatch.h>
#include <limits.h>
#include <pthread.h>
#include <stdatomic.h>
@ -116,7 +117,7 @@ static bool atrace_is_cmdline_match(const char* cmdline)
for (int i = 0; i < count; i++) {
snprintf(buf, sizeof(buf), "debug.atrace.app_%d", i);
property_get(buf, value, "");
if (strcmp(value, "*") == 0 || strcmp(value, cmdline) == 0) {
if (fnmatch(value, cmdline, FNM_NOESCAPE) == 0) {
return true;
}
}