traced_perf: support wildcards in /proc/pid/cmdline matching
This changes the semantics of the |target_cmdline| and |exclude_cmdline|
config fields. Normally we should've introduced a separate proto field
for this, but the change is compatible with vast majority of existing
configs, so it's less hassle for both us and users to reuse the field.
See go/perfetto-profiler-globs.
There are two compatibility cases to consider:
(a) old config expecting canonicalization + new profiler binary
(b) new config with a wildcard + old profiler binary
For (a), the primary difference is how a pattern with a fully qualified
path is treated. "/bin/echo" would previously canonicalize to "echo",
and match against anything with that suffix in argv0. Now we'll match
only against that particular fully qualified path. For (b), the old
implementation will try to do exact string comparisons, so patterns with
wildcards will effectively match nothing.
Configs that want to remain compatible with both versions of the
profiler can specify several versions of the same target_cmdline, as the
field is repeated. It'll potentially match more than before, but only in
corner cases.
Bug: 201273553
Change-Id: I48991992fb9456cfe11cab7ac7a92d7fff4ac71c
diff --git a/Android.bp b/Android.bp
index 0526976..cd592dc 100644
--- a/Android.bp
+++ b/Android.bp
@@ -10525,6 +10525,7 @@
":perfetto_src_profiling_common_callstack_trie",
":perfetto_src_profiling_common_interner",
":perfetto_src_profiling_common_interning_output",
+ ":perfetto_src_profiling_common_proc_cmdline",
":perfetto_src_profiling_common_proc_utils",
":perfetto_src_profiling_common_producer_support",
":perfetto_src_profiling_common_profiler_guardrails",